zhaolf 3 anni fa
parent
commit
7893719fb2
2 ha cambiato i file con 27 aggiunte e 2 eliminazioni
  1. 15 0
      src/pages/goods/addGoods/index.vue
  2. 12 2
      src/store/modules/user.js

+ 15 - 0
src/pages/goods/addGoods/index.vue

@@ -284,17 +284,32 @@
                 this.$refs.form.clearValidate()
                 if (this.$route.params.outProductId) { //新增获取详情
                     this.outProductId = this.$route.params.outProductId
+                    store.commit('SET_GOODS_ID',this.outProductId)
                     this.title='修改商品'
                     this.isdisable = false
+                    store.commit('SET_ISDISABLE',false)
                     this.getDetail()
                     if (this.$route.params.isDisable) {
                         this.title='商品详情'
                         this.isdisable = true
+                        store.commit('SET_ISDISABLE',true)
+                    }
+                }else if(store.getters.getGoodsId){
+                    this.outProductId=store.getters.getGoodsId
+                    this.title='修改商品'
+                    this.isdisable = false
+                    this.getDetail()
+                    if (store.getters.getIsDisable) {
+                        this.title='商品详情'
+                        this.isdisable = true
                     }
                 }
                 if (this.$route.params.isNew) { //新增清空
                     this.title='新增商品'
                     this.isdisable = false
+                    this.outProductId=0
+                    store.commit('SET_ISDISABLE',false)
+                    store.commit('SET_GOODS_ID',0)
                     this.outproductidDisable=false
                     if(this.$route.params.data){
                         this.title='新的审核内容'

+ 12 - 2
src/store/modules/user.js

@@ -6,7 +6,9 @@ const state = {
   tabIndex:0, //tab页的坐标
   outProductId:0,//商品详情id
   category_info_id:0,//类目详情id
-  brand_info_id:0,//品牌详情id
+  brand_info_id:0,//品牌详情id  
+  goodsid:0,//审核中商品id
+  isdisable:false//审核中商品编辑状态
 }
 const getters = {
   getToken: state => state.token,
@@ -16,9 +18,17 @@ const getters = {
   getTabIndex:state=>state.tabIndex,
   getOutProductId:state=>state.outProductId,
   getCategory_info_id:state=>state.category_info_id,
-  getBrand_info_id:state=>state.brand_info_id
+  getBrand_info_id:state=>state.brand_info_id,
+  getGoodsId:state=>state.goodsid,
+  getIsDisable:state=>state.isdisable
 }
 const mutations = {
+  SET_GOODS_ID(state, goodsid) {
+    state.goodsid = goodsid
+  },
+  SET_ISDISABLE(state, isdisable) {
+    state.isdisable = isdisable
+  },
   SET_USER_TOKEN(state, token) {
     state.token = token
   },