提交 3ba9c2c3 编写于 作者: zhongyao.qiao's avatar zhongyao.qiao

feat 库存校验

上级 6d768caa
此差异已折叠。
......@@ -6,7 +6,7 @@
"private": true,
"license": "GPL",
"scripts": {
"dev": "cross-env BUILD_ENV=development node build/dev-server.js",
"dev": "cross-env BUILD_ENV=test node build/dev-server.js",
"local": "cross-env BUILD_ENV=development node build/dev-server.js",
"build": "node build/build.js",
"build:dev": "cross-env BUILD_ENV=development node build/build.js",
......@@ -28,7 +28,7 @@
"iscroll": "^5.2.0",
"js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"jsencrypt": "^3.2.1",
"jsencrypt": "^3.3.1",
"jspdf": "^1.5.3",
"node-sass": "^4.9.2",
"pdfh5": "^1.3.9",
......
......@@ -3,7 +3,7 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/router'
import store from './store/'
const mixins = require('@/utils/mixins');
import mixins from '@/utils/mixins';
import FastClick from 'fastclick'
import vueFilters from '@/utils/filter'
import draggable from 'vuedraggable'
......@@ -30,12 +30,12 @@ Vue.use(VueVideoPlayer);
Vue.use(ElementUI)
// 注册所有公用过滤器
for(let key in vueFilters) {
for (let key in vueFilters) {
Vue.filter(key, vueFilters[key])
}
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
FastClick.attach(document.body);
}, false);
}
......@@ -45,7 +45,7 @@ const router = new VueRouter({
routes,
mode: 'hash',
strict: process.env.NODE_ENV !== 'production',
scrollBehavior (to, from, savedPosition) {
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
} else {
......@@ -59,14 +59,14 @@ const router = new VueRouter({
import utils from '@/utils/followup/followupUtils';
router.beforeEach((to, from, next) => {
if(to.meta.checkAuth){
utils.checkAuthFunc().then(res=>{
if(res==3){
if(to.meta.doctorAuth){
utils.getDoctorAuth(router).then(resAuth=>{
if(resAuth==3){
if (to.meta.checkAuth) {
utils.checkAuthFunc().then(res => {
if (res == 3) {
if (to.meta.doctorAuth) {
utils.getDoctorAuth(router).then(resAuth => {
if (resAuth == 3) {
next()
}else{
} else {
next(false)
return
}
......@@ -74,7 +74,7 @@ router.beforeEach((to, from, next) => {
return
}
next();
}else{
} else {
next({ path: "/home" });
return
}
......
import fetch from '@/utils/fetch'
import { getBaseUrl, getReportUrl, getWorkApi } from '@/utils/index'
import { CryptoJS } from '@/plugins/aes'
import 'jsencrypt'
import JSEncrypt from 'jsencrypt/bin/jsencrypt'
import { getPubKey } from '@/utils/account/accountApi';
let pubKey = "";
module.exports = {
export default {
data: function () {
return {
token: null
......@@ -18,7 +18,7 @@ module.exports = {
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null
},
mounted: function() {
mounted: function () {
},
methods: {
......@@ -29,33 +29,33 @@ module.exports = {
var aesKey = "";
var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strLen = strList.length;
for(var i=0; i<len; i++){
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) );
for (var i = 0; i < len; i++) {
aesKey += strList.charAt(Math.floor(Math.random() * strLen));
};
return aesKey;
},
// 加密传参,发送请求
sendEncryptRequest(content, cb){
sendEncryptRequest(content, cb) {
content = JSON.stringify(content); // 后端要求转 string
// debugger;
if(pubKey){ // pubKey获取过就不用再获取了
if (pubKey) { // pubKey获取过就不用再获取了
let params = this.formatContent(content, pubKey);
cb && cb(params);
}else{
} else {
this.handleGetPubKey(content, cb);
}
},
// get public key
handleGetPubKey(content, cb){
handleGetPubKey(content, cb) {
getPubKey().then(res => {
// console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res)
if(res.code == '000000'){
if (res.code == '000000') {
pubKey = res.data;
if(cb){
if (cb) {
let params = this.formatContent(content, pubKey);
cb && cb(params);
}
}else{
} else {
this.$message({
message: (res && res.message) || '接口出错',
type: 'warning'
......@@ -81,11 +81,11 @@ module.exports = {
AesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString();
},
// RSA encrypt
RsaEncrypt(aesKey, pubKey){
RsaEncrypt(aesKey, pubKey) {
let _encrypt = new JSEncrypt();
let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key);
......@@ -108,12 +108,12 @@ module.exports = {
return ''
},
setRouterParm(paramList){
setRouterParm(paramList) {
let parm = {};
if(paramList.length<=1){
if (paramList.length <= 1) {
return '';
}
for(let i=1;i<paramList.length;i++){
for (let i = 1; i < paramList.length; i++) {
parm[paramList[i].key] = paramList[i].value;
}
return parm;
......@@ -121,12 +121,12 @@ module.exports = {
// 拼接多个参数
getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
if (paramList.length <= 1) {
return ''
}
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
dataStr = list.join('&')
......@@ -145,7 +145,7 @@ module.exports = {
// 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return;
if (pageSize <= 0) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this,
para = {
......@@ -164,17 +164,17 @@ module.exports = {
// _this.searchText = ''
if (res.code == '000000') {
// 课程
if(searchCategory.indexOf('1') >= 0) {
if (searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || []
}
if(searchCategory.indexOf('2') >= 0) {
if (searchCategory.indexOf('2') >= 0) {
// sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
}
if(searchCategory.indexOf('3') >= 0) {
if (searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || []
}
if(searchCategory.indexOf('4') >= 0) {
if (searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents
}
}
......@@ -183,17 +183,17 @@ module.exports = {
return csourceData
},
setEventByModuleCode(itemData){
setEventByModuleCode(itemData) {
let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
} else if (modeCode === 'M100' || modeCode === 'M300') {
// 支持多个参数
let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){
if( paramList[0].value.indexOf("?") == -1){
if (paramList[0]) {
if (paramList[0].value.indexOf("?") == -1) {
paramList[0].value += urlPara
}
}
......@@ -203,8 +203,8 @@ module.exports = {
let v = paramList[0]['value'];
let query = this.setRouterParm(paramList);
paramList = [{
url:v,
query:query
url: v,
query: query
}]
this.$router.push({
path: v,
......@@ -213,14 +213,14 @@ module.exports = {
//alert(this.token);
return 'NO'
}
if(typeof paramList === 'string' && !paramList){
if (typeof paramList === 'string' && !paramList) {
paramList = []
}
return paramList;
},
// 通用GET请求
GET(api, para, callback,str) {
GET(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
url = encodeURI(url);
......@@ -230,7 +230,7 @@ module.exports = {
data: para
})
},
reportGET(api, para, callback,str) {
reportGET(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
url = encodeURI(url);
......@@ -254,7 +254,7 @@ module.exports = {
},
// 通用DELETE请求
DELETE(api, para, callback,str) {
DELETE(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
return fetch({
......@@ -293,7 +293,7 @@ module.exports = {
saasPOST(api, para, cType) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let header = {}
if(cType) {
if (cType) {
header['Content-Type'] = cType;
}
return fetch({
......
......@@ -3,13 +3,6 @@
*/
export const envConfig = {
development: {
// // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// baseUrl: 'https://uat-sc.yunqueyi.com/',
// baseUrl: 'http://10.177.15.150:10401/',
// baseUrl: 'http://10.177.15.150:11905/',
baseUrl: 'https://dev-sc.yunqueyi.com/',
// baseUrl: 'https://test1-sc.yunqueyi.com/',
// baseUrl: 'https://sc.yunqueyi.com/',
......
......@@ -213,7 +213,7 @@ export const getGoodsListAll = (params) => {
});
};
// 条形码获取信息
export const getBarcodeData =(barCode) => {
export const getBarcodeData = (barCode) => {
return fetch({
headers,
url: getBaseUrl(`store/admin/medical/queryByBarcode/${barCode}`),
......@@ -221,3 +221,13 @@ export const getBarcodeData =(barCode) => {
description: "条形码获取信息",
});
}
export const getGoodsStock = (params) => {
return fetch({
headers,
url: getBaseUrl('store/qianfang/storage/queryStorageStock'),
method: "get",
params,
description: "查询药品库存",
});
};
\ No newline at end of file
import fetch from '@/utils/fetch'
import { getBaseUrl, getReportUrl, getWorkApi, getCmsUrl } from '@/utils/index'
import { CryptoJS } from '@/plugins/aes'
import JSEncrypt from 'jsencrypt'
import JSEncrypt from 'jsencrypt/bin/jsencrypt'
import { getPubKey } from '@/utils/account/accountApi';
......@@ -18,7 +18,7 @@ module.exports = {
// this.token = this.getUrlSearch(location.href, 'token') || (query && query.token) || null
// this.token = this.getUrlKey('token') || (query && query.token) || null
},
mounted: function() {
mounted: function () {
},
methods: {
......@@ -29,33 +29,33 @@ module.exports = {
var aesKey = "";
var strList = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var strLen = strList.length;
for(var i=0; i<len; i++){
aesKey += strList.charAt( Math.floor( Math.random()*strLen ) );
for (var i = 0; i < len; i++) {
aesKey += strList.charAt(Math.floor(Math.random() * strLen));
};
return aesKey;
},
// 加密传参,发送请求
sendEncryptRequest(content, cb){
sendEncryptRequest(content, cb) {
content = JSON.stringify(content); // 后端要求转 string
// debugger;
if(pubKey){ // pubKey获取过就不用再获取了
if (pubKey) { // pubKey获取过就不用再获取了
let params = this.formatContent(content, pubKey);
cb && cb(params);
}else{
} else {
this.handleGetPubKey(content, cb);
}
},
// get public key
handleGetPubKey(content, cb){
handleGetPubKey(content, cb) {
getPubKey().then(res => {
// console.log('>>>>>>>>>>>>>>>>>>>> publicKey: ', res)
if(res.code == '000000'){
if (res.code == '000000') {
pubKey = res.data;
if(cb){
if (cb) {
let params = this.formatContent(content, pubKey);
cb && cb(params);
}
}else{
} else {
this.$message({
message: (res && res.message) || '接口出错',
type: 'warning'
......@@ -81,11 +81,11 @@ module.exports = {
AesEncrypt(content, aesKey) {
let sKey = CryptoJS.enc.Utf8.parse(aesKey);
let sContent = CryptoJS.enc.Utf8.parse(content);
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
let encrypted = CryptoJS.AES.encrypt(sContent, sKey, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString();
},
// RSA encrypt
RsaEncrypt(aesKey, pubKey){
RsaEncrypt(aesKey, pubKey) {
let _encrypt = new JSEncrypt();
let boss_public_key = pubKey;
_encrypt.setPublicKey(boss_public_key);
......@@ -108,12 +108,12 @@ module.exports = {
return ''
},
setRouterParm(paramList){
setRouterParm(paramList) {
let parm = {};
if(paramList.length<=1){
if (paramList.length <= 1) {
return '';
}
for(let i=1;i<paramList.length;i++){
for (let i = 1; i < paramList.length; i++) {
parm[paramList[i].key] = paramList[i].value;
}
return parm;
......@@ -121,12 +121,12 @@ module.exports = {
// 拼接多个参数
getUrlParmByCode(paramList) {
if ( paramList.length <= 1) {
if (paramList.length <= 1) {
return ''
}
let dataStr = ''
let list = [];
for( let i = 1; i < paramList.length; i ++) {
for (let i = 1; i < paramList.length; i++) {
list.push(paramList[i].key + '=' + paramList[i].value)
}
dataStr = list.join('&')
......@@ -145,7 +145,7 @@ module.exports = {
// 根据条件排序
async searchForOrder(searchCategory = '1', searchValue = '', sortItem = 1, pageSize = 10, sourceData = []) {
if(pageSize <=0 ) return;
if (pageSize <= 0) return;
let str2 = (searchValue || '').replace(/[\-\_\,\!\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\?]/g, '');// 去掉特殊字符
let _this = this,
para = {
......@@ -164,17 +164,17 @@ module.exports = {
// _this.searchText = ''
if (res.code == '000000') {
// 课程
if(searchCategory.indexOf('1') >= 0) {
if (searchCategory.indexOf('1') >= 0) {
sourceData = (res.data && res.data.contentAppModels) || []
}
if(searchCategory.indexOf('2') >= 0) {
if (searchCategory.indexOf('2') >= 0) {
// sourceData = []
sourceData = this.handelFive(res.data.fiveMinutesMedicalContentList || [])
}
if(searchCategory.indexOf('3') >= 0) {
if (searchCategory.indexOf('3') >= 0) {
sourceData = (res.data && res.data.pCourseDoctorModels) || []
}
if(searchCategory.indexOf('4') >= 0) {
if (searchCategory.indexOf('4') >= 0) {
sourceData = res.data.educationContents
}
}
......@@ -183,17 +183,17 @@ module.exports = {
return csourceData
},
setEventByModuleCode(itemData){
setEventByModuleCode(itemData) {
let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
if (modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
} else if (modeCode === 'M100' || modeCode === 'M300') {
// 支持多个参数
let urlPara = this.getUrlParmByCode(paramList);
if(paramList[0]){
if( paramList[0].value.indexOf("?") == -1){
if (paramList[0]) {
if (paramList[0].value.indexOf("?") == -1) {
paramList[0].value += urlPara
}
}
......@@ -203,8 +203,8 @@ module.exports = {
let v = paramList[0]['value'];
let query = this.setRouterParm(paramList);
paramList = [{
url:v,
query:query
url: v,
query: query
}]
this.$router.push({
path: v,
......@@ -213,7 +213,7 @@ module.exports = {
//alert(this.token);
return 'NO'
}
if(typeof paramList === 'string' && !paramList){
if (typeof paramList === 'string' && !paramList) {
paramList = []
}
return paramList;
......@@ -255,7 +255,7 @@ module.exports = {
},
// 通用DELETE请求
DELETE(api, para, callback,str) {
DELETE(api, para, callback, str) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let url = api + this.getUrlPara(para)
return fetch({
......@@ -304,7 +304,7 @@ module.exports = {
saasPOST(api, para, cType) {
// para.token = para.token || this.token || "343BCABC890349ACAF357FA79122F9FE"
let header = {}
if(cType) {
if (cType) {
header['Content-Type'] = cType;
}
return fetch({
......
......@@ -32,6 +32,7 @@ const form = {
saleType: 1,
minWhole: 1,
expressLimitFlag: 0, //是否支持退货退款
availableStock: "",
};
const form3 = {
......
......@@ -959,7 +959,7 @@ import {
getMedList,
saveMedList,
updateGoods,
updateStock,
getGoodsStock,
} from "@/utils/goods";
import { isEmptyUtils } from "@/utils/index";
import { createFilePath, doUpload, getFilePath } from "@/utils/qiniu-util";
......@@ -1617,7 +1617,6 @@ export default {
},
updateStock() {
let r = /^\+?[1-9][0-9]*$/;
//造假 接口来了删掉
if (this.stock.num <= 0) {
return this.$message({
message: "增加库存数量不得为0",
......@@ -1642,6 +1641,16 @@ export default {
this.formData.decrStock = Number(this.stock.num);
this.formData.incrStock = "";
} else if (this.stock.type == 2) {
if (
this.formData3.availableStock > 0 &&
this.formData3.availableStock <
this.formData.goodsStock + this.stock.num
) {
return this.$message({
message: `最大可用库存:${this.formData3.availableStock}`,
type: "warning",
});
}
this.formData.stock =
Number(this.stock.num) + Number(this.formData.goodsStock);
this.formData.incrStock = Number(this.stock.num);
......@@ -1664,6 +1673,24 @@ export default {
num: "",
placeholderTxt: txt,
};
if (this.formData3.medicationId) {
getGoodsStock({
medicationId: this.formData3.medicationId,
medicationDetailId: this.formData3.medicationDetailId,
})
.then((res) => {
if (res.code != "000000") {
return this.$message({
message: res.message,
type: "error",
});
}
this.formData.availableStock = res.data;
})
.catch((err) => {
console.log(err);
});
}
this.stockDio = true;
},
complete() {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册