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

存储数据store

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