提交 7bb75b07 编写于 作者: chendeli's avatar chendeli

存储数据store

上级 ce7042f2
import education from './education/getters' import education from './education/getters'
import custom from './custom/getters' import custom from './custom/getters'
import goods from './goodsManage/getters'
// import { containObject } from '../utils/utils' // import { containObject } from '../utils/utils'
// let getters = containObject(education) // let getters = containObject(education)
const getters = Object.assign(education, custom) const getters = Object.assign(education, custom,goods)
export default getters export default getters
\ No newline at end of file
const getters = {
// kind: state => state.customStore.kind,
// searchParam: state => state.customStore.searchParam,
// searchParamOrg: state => state.customStore.searchParamOrg,
// cartList: state => state.customStore.cartList,
// courseList: state => state.customStore.courseList,
// allLabelList: state => state.customStore.allLabelList,
// subLabelList: state => state.customStore.subLabelList,
// allLabelListOrg: state => state.customStore.allLabelListOrg,
// subLabelListOrg: state => state.customStore.subLabelListOrg,
// courseLimitCount: state => state.customStore.courseLimitCount,
goodsInfo: state => state.goodsManage.goodsInfo,
}
//console.log(getters)
export default getters
const goodsManage = {
namespaced: true,
state: {
goodsInfo: null,
},
mutations: {
CHANGE_GOODS_INFO: (state, data) => {
state.goodsInfo = data;
}
},
actions: {
changeGoodsInfo({ commit }, info) {
console.log(info)
commit('CHANGE_GOODS_INFO', info);
}
}
}
export default goodsManage;
...@@ -6,6 +6,7 @@ import followModules from './followup/index'; ...@@ -6,6 +6,7 @@ import followModules from './followup/index';
import getters from './getters' import getters from './getters'
//居民诊断 //居民诊断
import patientsDiagnose from './patientsManage/patientsDiagnose'; import patientsDiagnose from './patientsManage/patientsDiagnose';
import goodsManage from './goodsManage/goodsManage';
// cme // cme
import cmeStore from './cme/cmeStore'; import cmeStore from './cme/cmeStore';
...@@ -19,6 +20,7 @@ export default new Vuex.Store({ ...@@ -19,6 +20,7 @@ export default new Vuex.Store({
common, common,
...followModules, ...followModules,
patientsDiagnose, patientsDiagnose,
goodsManage,
cmeStore, cmeStore,
customStore customStore
}, },
......
...@@ -265,7 +265,13 @@ ...@@ -265,7 +265,13 @@
</el-form-item> </el-form-item>
<div class="inline"> <div class="inline">
<el-form-item label="适用科室" prop="department"> <el-form-item label="适用科室" prop="department">
<el-select <el-input
size="small"
v-model="formData.department"
placeholder="请输入适用科室"
></el-input>
<!-- <el-select
v-model="formData.department" v-model="formData.department"
placeholder="请选择适用科室" placeholder="请选择适用科室"
size="small" size="small"
...@@ -277,7 +283,7 @@ ...@@ -277,7 +283,7 @@
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
></el-option> ></el-option>
</el-select> </el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="治疗疾病" prop="treatDisease"> <el-form-item label="治疗疾病" prop="treatDisease">
<el-col :span="24"> <el-col :span="24">
...@@ -369,13 +375,14 @@ ...@@ -369,13 +375,14 @@
</el-form-item> --> </el-form-item> -->
</div> </div>
<div class="inline"> <div class="inline">
<el-form-item label="库存" prop="name"> <el-form-item label="库存" prop="name" class="required-label">
<el-col :span="20"> <el-col :span="20">
<div class="stock-com"> <div class="stock-com">
<span class="sp sp-l" @click="changeStock(1)" :class="{'opac':formData.stock == 0}"><i class="el-icon-minus"></i></span> <span class="sp sp-l" @click="changeStock(1)" :class="{'opac':formData.stock == 0}"><i class="el-icon-minus"></i></span>
<span class="sp sp-c">{{formData.stock}}</span> <span class="sp sp-c">{{formData.goodsStock}}</span>
<span class="sp sp-r" @click="changeStock(2)"><i class="el-icon-plus"></i></span> <span class="sp sp-r" @click="changeStock(2)"><i class="el-icon-plus"></i></span>
</div> </div>
<p class="upload-message" v-if="!isgoodStock">请上传商品头图</p>
<!-- <el-input <!-- <el-input
size="small" size="small"
v-model="formData.name" v-model="formData.name"
...@@ -446,6 +453,7 @@ ...@@ -446,6 +453,7 @@
import { doUpload, getFilePath } from "../../utils/qiniu-util"; import { doUpload, getFilePath } from "../../utils/qiniu-util";
import { updateGoods ,updateStock,dosageAll,getDeparts} from '@/utils/goods'; import { updateGoods ,updateStock,dosageAll,getDeparts} from '@/utils/goods';
import Cropper from '@/components/common/cropper.vue' import Cropper from '@/components/common/cropper.vue'
import { mapGetters } from "vuex";
export default { export default {
components: { components: {
BreadCrumb, BreadCrumb,
...@@ -474,21 +482,22 @@ ...@@ -474,21 +482,22 @@
fileIntrList:[], fileIntrList:[],
intrIndex:-1, intrIndex:-1,
isShowFileList:false, isShowFileList:false,
isgoodStock:true,
headIndex:-1, headIndex:-1,
oneLever:[], oneLever:[],
twoLever:[], twoLever:[],
allDeparts:[], allDeparts:[],
threeLever:[{ threeLever:[{
categoryName: "默认", categoryName: "其他",
id:0 id:-1
}], }],
fourLever:[{ fourLever:[{
categoryName: "默认", categoryName: "其他",
id:0 id:-1
}], }],
fiveLever:[{ fiveLever:[{
categoryName: "默认", categoryName: "其他",
id:0 id:-1
}], }],
stockDio:false, stockDio:false,
curmbFirst: '云鹊店铺', curmbFirst: '云鹊店铺',
...@@ -532,6 +541,7 @@ ...@@ -532,6 +541,7 @@
barCode:'', barCode:'',
discountPrice:'', discountPrice:'',
stock:0, stock:0,
goodsStock:0,
specificationImages:[], specificationImages:[],
goodsId:'', goodsId:'',
costPrice:'', costPrice:'',
...@@ -631,9 +641,12 @@ ...@@ -631,9 +641,12 @@
isMedic:false, isMedic:false,
} }
}, },
computed: {
...mapGetters(["goodsInfo"])
},
created() { created() {
vm = this; vm = this;
console.log(this.$route)
const {id} = this.$route.query const {id} = this.$route.query
this.title = id == 'add' ? '新增商品' : '编辑商品' this.title = id == 'add' ? '新增商品' : '编辑商品'
this.getLever(0,1) this.getLever(0,1)
...@@ -643,6 +656,12 @@ ...@@ -643,6 +656,12 @@
getDeparts().then((res)=>{ getDeparts().then((res)=>{
this.allDeparts = res.data this.allDeparts = res.data
}) })
if(id != 'add'){
let goods = Object.assign(this.goodsInfo,{})
this.formData = {...goods}
console.log(goods)
}
}, },
methods: { methods: {
getGoodsTypes(id,type){ getGoodsTypes(id,type){
...@@ -656,8 +675,8 @@ ...@@ -656,8 +675,8 @@
defaultArr(){ defaultArr(){
let a = [ let a = [
{ {
categoryName: "默认", categoryName: "其他",
id:0 id:-1
} }
] ]
return a return a
...@@ -748,6 +767,7 @@ ...@@ -748,6 +767,7 @@
this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true this.isSpecification_url = this.formData.specificationImages.length == 0 ? false : true
this.formData.categoryId = this.formData.goodsType this.formData.categoryId = this.formData.goodsType
this.formData.otc = this.formData.otc1 == 1 ? true : false this.formData.otc = this.formData.otc1 == 1 ? true : false
this.isgoodStock = this.formData.goodsStock > 0 ? true : false
if(this.isMedic){ if(this.isMedic){
if(!this.isgoodsImages){ if(!this.isgoodsImages){
return; return;
......
...@@ -319,6 +319,7 @@ ...@@ -319,6 +319,7 @@
}else{ }else{
url = `/create-good?id=${row.id}` url = `/create-good?id=${row.id}`
} }
this.$store.dispatch('goodsManage/changeGoodsInfo', {...row});
this.$router.push({ this.$router.push({
path: url path: url
}) })
...@@ -397,7 +398,8 @@ ...@@ -397,7 +398,8 @@
searchList() { searchList() {
openLoading(this); openLoading(this);
let params = this.searchForm;
this.searchForm.pageNo = 1
this.getLists() this.getLists()
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册