产品服务包模块
This commit is contained in:
5
.idea/.gitignore
generated
vendored
Normal file
5
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
14
.idea/UniappTool.xml
generated
Normal file
14
.idea/UniappTool.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
|
||||||
|
<option name="basePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="generalBasePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
|
||||||
|
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
|
||||||
|
<option name="scanNum" value="1" />
|
||||||
|
<option name="type" value="store" />
|
||||||
|
<option name="uniapp" value="true" />
|
||||||
|
<option name="uniappHx" value="true" />
|
||||||
|
<option name="vueVersion" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
43
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
43
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="2">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="class" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="style" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="18">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="nobr" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="noembed" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="comment" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="noscript" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="embed" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="script" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="u-button" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="d-loading-page" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="u-modal" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="u-loading" />
|
||||||
|
<item index="10" class="java.lang.String" itemvalue="u-image" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="block" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="u-gap" />
|
||||||
|
<item index="13" class="java.lang.String" itemvalue="u-tag" />
|
||||||
|
<item index="14" class="java.lang.String" itemvalue="scroll-view" />
|
||||||
|
<item index="15" class="java.lang.String" itemvalue="u-icon" />
|
||||||
|
<item index="16" class="java.lang.String" itemvalue="d-number-box" />
|
||||||
|
<item index="17" class="java.lang.String" itemvalue="l-painter" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
6
.idea/jsLibraryMappings.xml
generated
Normal file
6
.idea/jsLibraryMappings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<excludedPredefinedLibrary name="uni-api" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/xk-doctor-wx.iml" filepath="$PROJECT_DIR$/.idea/xk-doctor-wx.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
12
.idea/xk-doctor-wx.iml
generated
Normal file
12
.idea/xk-doctor-wx.iml
generated
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
50
api/servicePackage.js
Normal file
50
api/servicePackage.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import {
|
||||||
|
req
|
||||||
|
} from '@/common/js/index.js';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 添加西药-全部西药列表
|
||||||
|
/**
|
||||||
|
* @param {Object} data
|
||||||
|
* 参数名称 必须 参数类型 说明
|
||||||
|
*/
|
||||||
|
export function servicePageList(data) {
|
||||||
|
return req.request({
|
||||||
|
url: 'prescription/service-package-list',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 添加西药-常用西药列表
|
||||||
|
/**
|
||||||
|
* @param {Object} data
|
||||||
|
* 参数名称 必须 参数类型 说明
|
||||||
|
*/
|
||||||
|
export function servicePageCommon(data) {
|
||||||
|
return req.request({
|
||||||
|
url: 'prescription/service-package-common',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加颗粒药药方
|
||||||
|
export function addServicePackageRecipe(data) {
|
||||||
|
return req.request({
|
||||||
|
url: 'prescription/add-service-package-recipe',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开服务包处方 prescription/add-granular-prescription
|
||||||
|
export function addServicePackagePrescription(data) {
|
||||||
|
return req.request({
|
||||||
|
url: 'prescription/add-prescription-service-package',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -50,4 +50,4 @@
|
|||||||
|
|
||||||
function _isPromise(obj) {
|
function _isPromise(obj) {
|
||||||
return obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'
|
return obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,39 @@
|
|||||||
import Request from './request.js';
|
import Request from './request.js';
|
||||||
import errorCode from './errorCode.js';
|
import errorCode from './errorCode.js';
|
||||||
let protocol = 'https'; //协议
|
import {Base64} from "js-base64";
|
||||||
let baseUrl = 'app.xiaokang88.com/service/v1/'; // 域名
|
// let protocol = 'https'; //协议
|
||||||
// let protocol = 'http'; //协议
|
// let baseUrl = 'app.xiaokang88.com/service/v1/'; // 域名
|
||||||
// let baseUrl = 'www.xk888.com/service/v1/'; // 域名
|
let protocol = 'http'; //协议
|
||||||
|
let baseUrl = 'www.xk888.com/service/v1/'; // 域名
|
||||||
export const config = {
|
export const config = {
|
||||||
baseUrl: `${protocol}://${baseUrl}`
|
baseUrl: `${protocol}://${baseUrl}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const arr = [
|
||||||
|
'mobile',
|
||||||
|
'express_mobile',
|
||||||
|
'doctor',
|
||||||
|
'accept_tel',
|
||||||
|
'patient_mobile',
|
||||||
|
'id_card',
|
||||||
|
'idcard',
|
||||||
|
'password'
|
||||||
|
]
|
||||||
|
|
||||||
|
// 敏感数据
|
||||||
|
const sensitiveData = [
|
||||||
|
'id_card',
|
||||||
|
'idcard'
|
||||||
|
]
|
||||||
/**
|
/**
|
||||||
* 请求拦截器
|
* 请求拦截器
|
||||||
* @param {*} options
|
* @param {*} options
|
||||||
*/
|
*/
|
||||||
const reqInterceptor = async (options) => {
|
const reqInterceptor = async (options) => {
|
||||||
|
// 加密
|
||||||
|
if (options.data != null) {
|
||||||
|
options.data = getRes(options.data, false)
|
||||||
|
}
|
||||||
options.header = {
|
options.header = {
|
||||||
...options.header
|
...options.header
|
||||||
}
|
}
|
||||||
@@ -31,7 +53,12 @@ const resInterceptor = (response, conf = {}) => {
|
|||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
if (statusCode >= 200 && statusCode < 300) {
|
if (statusCode >= 200 && statusCode < 300) {
|
||||||
_responseLog(response, conf, "response 200-299")
|
_responseLog(response, conf, "response 200-299")
|
||||||
return response.data
|
// 解密
|
||||||
|
let res = response.data
|
||||||
|
if (res.data != null) {
|
||||||
|
res.data = getRes(res.data)
|
||||||
|
}
|
||||||
|
return res
|
||||||
} else if (statusCode === 500) {
|
} else if (statusCode === 500) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
@@ -69,7 +96,6 @@ const resInterceptor = (response, conf = {}) => {
|
|||||||
res: response
|
res: response
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: response['msg'] || errorCode[statusCode]
|
title: response['msg'] || errorCode[statusCode]
|
||||||
@@ -106,6 +132,101 @@ function _responseLog(res, conf = {}, describe = null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRes(obj, isDecode = true) {
|
||||||
|
try {
|
||||||
|
for (const key in obj) {
|
||||||
|
if (Array.isArray(obj[key])) {
|
||||||
|
obj[key] = getRes(obj[key])
|
||||||
|
} else if (typeof obj[key] === 'object') {
|
||||||
|
obj[key] = getRes(obj[key])
|
||||||
|
} else {
|
||||||
|
// 判断obj[key]是否在arr中
|
||||||
|
if (arr.indexOf(key) !== -1) {
|
||||||
|
let aseFile = ''
|
||||||
|
if (isDecode === true) {
|
||||||
|
aseFile = customBase64Decode(obj[key])
|
||||||
|
} else {
|
||||||
|
aseFile = customBase64Encode(obj[key])
|
||||||
|
}
|
||||||
|
const isGarbled = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]|[\u{E000}-\u{F8FF}]/u.test(
|
||||||
|
typeof aseFile === 'string' ? aseFile : ''
|
||||||
|
)
|
||||||
|
if (isGarbled) {
|
||||||
|
aseFile = obj[key]
|
||||||
|
}
|
||||||
|
if (isDecode === true) {
|
||||||
|
if (sensitiveData.indexOf(key) !== -1) {
|
||||||
|
// 数据脱敏,自动匹配姓名、手机号、身份证
|
||||||
|
switch (key) {
|
||||||
|
case 'express_name':
|
||||||
|
case 'express_region':
|
||||||
|
case 'accept_name':
|
||||||
|
case 'patient':
|
||||||
|
// 保留前两个字符,其余用星号代替
|
||||||
|
aseFile = aseFile.slice(0, 1).padEnd(aseFile.length, '*');
|
||||||
|
break;
|
||||||
|
case 'mobile':
|
||||||
|
case 'express_mobile':
|
||||||
|
// 保留前三位和后四位,中间用星号代替
|
||||||
|
aseFile = aseFile.slice(0, 3).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4);
|
||||||
|
break;
|
||||||
|
case 'id_card':
|
||||||
|
case 'idcard':
|
||||||
|
// 保留前六位和后四位,中间用星号代替
|
||||||
|
aseFile = aseFile.slice(0, 6).padEnd(aseFile.length - 4, '*') + aseFile.slice(-4);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 默认情况下,全部用星号代替
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj[key] = aseFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
} catch (error) {
|
||||||
|
console.error('错误', error)
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function customBase64Decode(data) {
|
||||||
|
// return data
|
||||||
|
try {
|
||||||
|
// 第一次Base64解码
|
||||||
|
const decodedFirst = Base64.decode(data)
|
||||||
|
// 截取从第30个字符开始往后的内容
|
||||||
|
const subStr = decodedFirst.slice(30)
|
||||||
|
// 第二次Base64解码
|
||||||
|
return Base64.decode(subStr) != ''? Base64.decode(subStr): data
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`解码Base64字符串【${data}】时发生错误`, error)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加密
|
||||||
|
function customBase64Encode(data) {
|
||||||
|
if (data == null || data === '') return data
|
||||||
|
// return data
|
||||||
|
try {
|
||||||
|
// 和加密方法差不多但是是要生成30个随机字符
|
||||||
|
let randomString = ''
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
const randomChar = String.fromCharCode(Math.floor(Math.random() * (126 - 32 + 1)) + 32)
|
||||||
|
randomString += randomChar
|
||||||
|
}
|
||||||
|
const encoded = Base64.encode(data)
|
||||||
|
return Base64.encode(randomString + encoded)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`加密字符串【${data}】时发生错误`, error)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求方法封装
|
* 请求方法封装
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -94,4 +94,4 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
// 后端地址
|
// 后端地址
|
||||||
action: {
|
action: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'https://app.xiaokang88.com/service/v1/attachment/upload'
|
default: 'https://api.xiaokang88.com/open-api/upload/old-admin-img'
|
||||||
},
|
},
|
||||||
// 最大上传数量
|
// 最大上传数量
|
||||||
maxCount: {
|
maxCount: {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
"editor"
|
"editor"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"js-base64": "^3.7.7",
|
||||||
"uview-ui": "^1.8.8"
|
"uview-ui": "^1.8.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
pnpm-lock.yaml
generated
Normal file
22
pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
dependencies:
|
||||||
|
uview-ui:
|
||||||
|
specifier: ^1.8.8
|
||||||
|
version: 1.8.8
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
uview-ui@1.8.8:
|
||||||
|
resolution: {integrity: sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg==, tarball: https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz}
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
uview-ui@1.8.8: {}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<d-text :text="userInfo.title.name" color="#31353D"></d-text>
|
<d-text :text="userInfo.title.name" color="#31353D"></d-text>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="p-row-32 m-t-8" style="height: 100rpx;">
|
<view class="p-row-32 m-t-8" style="height: 100rpx;">
|
||||||
<u-button :throttle-time="0" shape="circle" :custom-style="{backgroundColor:'#6ACDBB',color:'#fff',heigth:'96rpx'}" @click="logout">
|
<u-button :throttle-time="0" shape="circle" :custom-style="{backgroundColor:'#6ACDBB',color:'#fff',heigth:'96rpx'}" @click="logout">
|
||||||
退出登录</u-button>
|
退出登录</u-button>
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'https://app.xiaokang88.com/service/v1/attachment/upload',
|
url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
|
||||||
filePath: res.tempFiles[0]['path'],
|
filePath: res.tempFiles[0]['path'],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
@@ -172,4 +172,4 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -375,7 +375,7 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
selectActed(){
|
selectActed(){
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
@@ -397,7 +397,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'https://app.xiaokang88.com/service/v1/attachment/upload',
|
url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
|
||||||
filePath: res.tempFiles[0]['path'],
|
filePath: res.tempFiles[0]['path'],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'https://app.xiaokang88.com/service/v1/attachment/upload',
|
url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
|
||||||
filePath: res.tempFiles[0]['path'],
|
filePath: res.tempFiles[0]['path'],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
@@ -563,4 +563,4 @@
|
|||||||
margin-left: 5%;
|
margin-left: 5%;
|
||||||
bottom: env(safe-area-inset-bottom);
|
bottom: env(safe-area-inset-bottom);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,476 @@
|
|||||||
|
<template>
|
||||||
|
<view class="safe-area-inset-bottom white">
|
||||||
|
<view class="search">
|
||||||
|
<u-search :height="66" :inputStyle="{height:'66rpx'}" @custom="keyword=''" :show-action="false"
|
||||||
|
placeholder="请输入您想要的商品" v-model="keyword" @input="getDrugList"></u-search>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y="true" style="padding-bottom: 200rpx">
|
||||||
|
<!-- 西药 -->
|
||||||
|
<block v-if="type==3">
|
||||||
|
<view class="b-r-8 p-32" v-for="(item,i) in setList" :key="item.id">
|
||||||
|
<view class="flex-row mb40">
|
||||||
|
<u-image width="128rpx" height="144rpx" border-radius="8" :src="item.image">
|
||||||
|
<u-loading slot="loading"></u-loading>
|
||||||
|
</u-image>
|
||||||
|
<view class="m-l-24 flex-1">
|
||||||
|
<view>
|
||||||
|
<d-text :text="item.drug_name" className="fs-3 content-c"></d-text>
|
||||||
|
</view>
|
||||||
|
<d-text :text="'规格:'+item.specification" className="fs-24 tips-c mtb12"
|
||||||
|
style="margin-left: 5rpx;"></d-text>
|
||||||
|
<view class="flex-row flex-jus-sp flex-ali-center ">
|
||||||
|
<view class="flex-row flex-1">
|
||||||
|
<d-text :text="'库存:剩余'" className="fs-24 tips-c"></d-text>
|
||||||
|
<d-text :text="item.stock" className="colorG fz24"></d-text>
|
||||||
|
<d-text text="件" className="fs-24 tips-c"></d-text>
|
||||||
|
</view>
|
||||||
|
<view class="price">
|
||||||
|
¥{{ parseFloat(item.price).toFixed(2) }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="m-t08 flex-row flex-jus-sp flex-ali-center">
|
||||||
|
<view class="flex-row flex-1 flex-jus-sp ">
|
||||||
|
<block v-if="!item.is_add">
|
||||||
|
<view class="flex-row flex-ali-center btnBox">
|
||||||
|
<u-icon name="plus" color="#6ACDBB" size="26"></u-icon>
|
||||||
|
<d-text :text="'未添加'" className="fs-24 ml14" color="#6ACDBB"></d-text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="m-l-32">
|
||||||
|
<u-button :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }" shape="circle"
|
||||||
|
size="mini" @click="handleAdd(item, i)">
|
||||||
|
添加商品
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<!-- <view v-else class="flex-row flex-ali-center btnBox">-->
|
||||||
|
<!-- <d-text :text="`已添加(${item.number})周期`" className="fs-24 ml14" color="#6ACDBB"></d-text>-->
|
||||||
|
<!-- </view>-->
|
||||||
|
<d-number-box v-else v-model="item.number" :min="0" :max="item.stock"
|
||||||
|
:asyncChange="true">
|
||||||
|
<view slot="minus" class="minus flex-row flex-jus-center flex-ali-center"
|
||||||
|
:style="{backgroundColor:`rgba(249, 250, 251,${item.number>0?1:0.6})`}"
|
||||||
|
@click="clickHandler('minus',item,item.number)">
|
||||||
|
<u-icon name="minus" size="22" :color="item.number>0?'#000':'#A7ABB0'"></u-icon>
|
||||||
|
</view>
|
||||||
|
<view slot="input" style="width: 80rpx;"
|
||||||
|
class="input flex-row flex-jus-center flex-ali-center">
|
||||||
|
<d-text :text="item.number" className="fs-3 content-c"></d-text>
|
||||||
|
</view>
|
||||||
|
</d-number-box>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<view class="flex-row flex-jus-center box"
|
||||||
|
v-if="!loading&&((type===2||type===3)&&list[0].length===0||type===1&&setList.length===0)">
|
||||||
|
<d-empty :text="keyword?'换个名称试试':current===1?'去收藏药品吧!':'暂无药品'" mode="search"></d-empty>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<view class="btn" v-if="shownum">
|
||||||
|
<u-button :throttle-time="0" :custom-style="{ backgroundColor:'#6ACDBB',color:'#fff' }" shape="circle"
|
||||||
|
@click="toBack" :loading="loading">
|
||||||
|
添加到处方
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 添加西药详情 -->
|
||||||
|
<add-set-usage :info="info" @close="show=false"
|
||||||
|
@add="index!==-1&&$set(list,index,$event);index=-1;show=false;type===1?drugList(current):$go(1, 4);recipe={}"
|
||||||
|
:type="type" v-if="type>0&&show" :idx='idx' :recipe="recipe" :is_set="!!recipe['pId']">
|
||||||
|
</add-set-usage>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import mixin from './mixin/mixin.js';
|
||||||
|
import addSetUsage from './components/add-setUsage.vue'
|
||||||
|
import {servicePageList,} from '@/api/servicePackage.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
addSetUsage
|
||||||
|
},
|
||||||
|
mixins: [mixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
recipe: {},
|
||||||
|
affirmShow: false,
|
||||||
|
index: -1,
|
||||||
|
info: {},
|
||||||
|
show: false,
|
||||||
|
tabs: [{
|
||||||
|
id: 0,
|
||||||
|
name: '全部药品'
|
||||||
|
}, {
|
||||||
|
id: 1,
|
||||||
|
name: '我的常用药'
|
||||||
|
}],
|
||||||
|
list: {
|
||||||
|
0: [],
|
||||||
|
1: [],
|
||||||
|
},
|
||||||
|
keyword: '',
|
||||||
|
current: 0,
|
||||||
|
type: 0,
|
||||||
|
searchList: {
|
||||||
|
0: [],
|
||||||
|
1: [],
|
||||||
|
},
|
||||||
|
idx: 0,
|
||||||
|
shownum: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
setList() {
|
||||||
|
this.getDrug();
|
||||||
|
let list = this.list[this.current]?.length > 0 ? this.list[this.current] : [];
|
||||||
|
let arr = [];
|
||||||
|
arr = this.servicePackage
|
||||||
|
console.log(list, 'this.servicePackage')
|
||||||
|
console.log(arr, 'this.servicePackage')
|
||||||
|
list = list.map((item) => {
|
||||||
|
let it = arr.find(it => it['id'] === item.id) || {};
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
...it,
|
||||||
|
is_add: !!it['id'],
|
||||||
|
stock: item['stock'] - (it['number'] || 0)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
return this.list[this.current].filter(item => item.checked).map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
grammage: item.grammage || 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getSelect() {
|
||||||
|
return this.list[this.current].filter(item => item.checked).length
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
this.current = op['current'] || 0;
|
||||||
|
this.type = 3;
|
||||||
|
this.idx = op['index'] || 0;
|
||||||
|
this.recipe = op['recipe'] ? JSON.parse(op['recipe']) : {}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...'
|
||||||
|
})
|
||||||
|
this.drugList();
|
||||||
|
this.getDrug();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toBack() {
|
||||||
|
uni.navigateBack(1)
|
||||||
|
},
|
||||||
|
changeCheckbox(e, cur) {
|
||||||
|
this.list[cur] = this.list[cur].map(item => {
|
||||||
|
if (item.id === e.id) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
checked: !item.checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async hoarding(id, type = 0) {
|
||||||
|
let res = {}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '请稍后...'
|
||||||
|
})
|
||||||
|
// type == 0 && (res = await westCollection({
|
||||||
|
// id,
|
||||||
|
// store_id: uni.getStorageSync('store_id') || '11001'
|
||||||
|
// }))
|
||||||
|
// type == 1 && (res = await westUncollect({
|
||||||
|
// id,
|
||||||
|
// store_id: uni.getStorageSync('store_id') || '11001'
|
||||||
|
// }))
|
||||||
|
if (res.errcode === 0) {
|
||||||
|
this.list[this.current] = this.list[this.current].map((it) => {
|
||||||
|
return {
|
||||||
|
...it,
|
||||||
|
is_collect: id === it['id'] ? !it.is_collect : it.is_collect
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$toast(res.msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getDrugList() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '搜索中...'
|
||||||
|
})
|
||||||
|
this.loading = true
|
||||||
|
uni.$u.debounce(this.drugList, 1000);
|
||||||
|
},
|
||||||
|
// 药品列表
|
||||||
|
async drugList() {
|
||||||
|
this.list[this.current] = [];
|
||||||
|
let res = {};
|
||||||
|
|
||||||
|
(res = await servicePageList({
|
||||||
|
name: this.keyword,
|
||||||
|
store_id: uni.getStorageSync('store_id') || '11001'
|
||||||
|
}))
|
||||||
|
|
||||||
|
if (res.errcode === 0) {
|
||||||
|
let collect = Array.isArray(res.data) ? res.data : res.data.collect || res.data.collected;
|
||||||
|
collect = (collect || []).map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
is_collect: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let no_collect = res.data.no_collect || []
|
||||||
|
let uncollect = res.data.uncollect || []
|
||||||
|
uncollect = [...uncollect, ...no_collect].map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
is_collect: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.list[this.current] = collect.concat(this.current == 0 ? uncollect : [])
|
||||||
|
console.log(this.list[this.current], 'sssssssssssssssssssssss')
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.loading = false
|
||||||
|
uni.hideLoading()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
this.$toast(res.msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clickHandler(type, data, number) {
|
||||||
|
let that = this;
|
||||||
|
let item = JSON.parse(JSON.stringify(data));
|
||||||
|
item['number'] = number || item['number']
|
||||||
|
if (type === 'minus' && item['number'] == 1) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确认从处方中删除该药品',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 根据item的id找到对应的索引
|
||||||
|
let type = that.type;
|
||||||
|
let index = that.servicePackage.findIndex(it => it.id === item.id)
|
||||||
|
// 如果index有效,则执行删除和存储操作
|
||||||
|
if (index >= 0) {
|
||||||
|
// 根据type的值,从对应的数组中删除指定索引的元素
|
||||||
|
that.servicePackage.splice(index, 1);
|
||||||
|
// 定义变量key用于存储缓存键名
|
||||||
|
let key = null
|
||||||
|
key = uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage'
|
||||||
|
// 将修改后的数组存储到缓存中,如果数组为空则存储默认值
|
||||||
|
uni.setStorageSync(key, this.servicePackage)
|
||||||
|
// 调用getDrug方法,可能用于更新药物数据
|
||||||
|
that.getDrug()
|
||||||
|
} else {
|
||||||
|
// 如果index无效,清空所有数组和相关缓存
|
||||||
|
this.servicePackage = []
|
||||||
|
uni.removeStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage')
|
||||||
|
// 同样,设置缓存,存储空的数组结构
|
||||||
|
uni.setStorageSync(uni.getStorageSync('add') ? 'addServicePackage' : 'servicePackage', [{
|
||||||
|
item: [],
|
||||||
|
obj: {}
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$set(item, 'number', item['number'])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item['number'] != 0 && type === 'minus' && item['number']--;
|
||||||
|
item['number'] < item.stock && type === 'plus' && item['number']++
|
||||||
|
this.setDrug(item);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 添加西药
|
||||||
|
handleAdd(item, i) {
|
||||||
|
// console.log(item, 'item')
|
||||||
|
this.show = true
|
||||||
|
this.info = {
|
||||||
|
...item
|
||||||
|
}
|
||||||
|
this.index = i
|
||||||
|
this.shownum = true
|
||||||
|
},
|
||||||
|
setChecked(id) {
|
||||||
|
this.list[this.current] = this.list[this.current].map(item => {
|
||||||
|
if (item.id == id) {
|
||||||
|
item.checked = !item.checked
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.search {
|
||||||
|
padding: 16rpx 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 710rpx;
|
||||||
|
margin: 20rpx auto;
|
||||||
|
position: fixed;
|
||||||
|
left: 2.2%;
|
||||||
|
bottom: 20rpx;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.minus {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #F9FAFB;
|
||||||
|
border-top-left-radius: 8rpx;
|
||||||
|
border-bottom-left-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plus {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #2979FF;
|
||||||
|
border-top-right-radius: 8rpx;
|
||||||
|
border-bottom-right-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
width: 122rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #F3F4F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
position: fixed;
|
||||||
|
width: 100vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
bottom: env(safe-area-inset-bottom);
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 12rpx 32rpx;
|
||||||
|
|
||||||
|
::v-deep button {
|
||||||
|
z-index: 999;
|
||||||
|
background: #6ACDBB;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-b-16 {
|
||||||
|
::v-deep button {
|
||||||
|
z-index: 999;
|
||||||
|
background: #6ACDBB;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
width: 122rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-family: PingFang SC-Regular, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #A7ABB0;
|
||||||
|
text-align-last: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #F44437;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search {
|
||||||
|
padding: 16rpx 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colorG {
|
||||||
|
color: #6ACDBB !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.fz24 {
|
||||||
|
font-size: 24rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.minus {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #F9FAFB;
|
||||||
|
border-top-left-radius: 8rpx;
|
||||||
|
border-bottom-left-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plus {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #6ACDBB;
|
||||||
|
border-top-right-radius: 8rpx;
|
||||||
|
border-bottom-right-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
width: 122rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #F3F4F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mtb12 {
|
||||||
|
margin: 12rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
position: fixed;
|
||||||
|
width: 100vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
bottom: env(safe-area-inset-bottom);
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 12rpx 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
width: 122rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-family: PingFang SC-Regular, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #A7ABB0;
|
||||||
|
text-align-last: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnBox {
|
||||||
|
height: 48rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
border: 2rpx solid #6ACDBB;
|
||||||
|
|
||||||
|
&.del {
|
||||||
|
border: 2rpx solid #FC3636;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb40 {
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ml14 {
|
||||||
|
margin-left: 14rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -360,7 +360,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'https://app.xiaokang88.com/service/v1/attachment/upload',
|
url: 'https://api.xiaokang88.com/open-api/upload/old-admin-img',
|
||||||
filePath: res.tempFiles[0]['path'],
|
filePath: res.tempFiles[0]['path'],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
@@ -700,4 +700,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
13
yarn.lock
Normal file
13
yarn.lock
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
js-base64@^3.7.7:
|
||||||
|
version "3.7.7"
|
||||||
|
resolved "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz"
|
||||||
|
integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==
|
||||||
|
|
||||||
|
uview-ui@^1.8.8:
|
||||||
|
version "1.8.8"
|
||||||
|
resolved "https://registry.npmmirror.com/uview-ui/-/uview-ui-1.8.8.tgz"
|
||||||
|
integrity sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg==
|
||||||
Reference in New Issue
Block a user