瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/admin into dev

yuantianjiao 6 年之前
父節點
當前提交
e913c83b34

+ 51
- 5
src/pages/system/goodsManager/goodsSpecManager/add.vue 查看文件

8
             <div style="width:50%">
8
             <div style="width:50%">
9
               <el-input
9
               <el-input
10
                 placeholder="请输入规格名"
10
                 placeholder="请输入规格名"
11
-                v-model="postData.goodsSpec"
11
+                v-model="postData.SpecName"
12
                 clearable>
12
                 clearable>
13
               </el-input>
13
               </el-input>
14
             </div>
14
             </div>
15
           </div>
15
           </div>
16
         </li>
16
         </li>
17
+        <li class="flex-h">
18
+          <span>选择案场:</span>
19
+          <div class="flex-item">
20
+            <div style="width:50%">
21
+              <el-select v-model="CaseId" placeholder="请选择">
22
+                <el-option
23
+                  v-for="item in cases"
24
+                  :key="item.CaseId"
25
+                  :label="item.CaseName"
26
+                  :value="item.CaseId">
27
+                </el-option>
28
+              </el-select>
29
+            </div>
30
+          </div>
31
+        </li>
17
         <li style="text-align:center">
32
         <li style="text-align:center">
18
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
33
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
19
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
34
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
24
 </template>
39
 </template>
25
 
40
 
26
 <script>
41
 <script>
42
+import { mapState } from 'vuex'
43
+
27
 export default {
44
 export default {
28
   name: '',
45
   name: '',
29
   data () {
46
   data () {
30
     return {
47
     return {
31
       postData: {
48
       postData: {
32
-        goodsSpec: ''
49
+        SpecId: '', // 规格id(新增传空值)
50
+        SpecName: '', // 规格名称
51
+        Status: '', // 状态(无状态可传空值)
52
+        OrgId: '', // 机构id
53
+        CaseId: '', // 案场id
54
+      }
55
+    }
56
+  },
57
+  computed: {
58
+    ...mapState({
59
+      cases: x => x.app.cases,
60
+      OrgId: x => x.app.user.OrgId,
61
+    }),
62
+    CaseId: {
63
+      get () {
64
+        return this.postData.CaseId === '' ? (((this.cases || []).filter(x => x.IsBelong === 1))[0] || {}).CaseId || '' : this.postData.CaseId
65
+      },
66
+      set (val) {
67
+        this.postData.CaseId = val
33
       }
68
       }
34
     }
69
     }
35
   },
70
   },
36
   components: {},
71
   components: {},
37
   methods: {
72
   methods: {
38
-    submit () {
39
-      console.log(this.postData)
73
+    submit () { // 提交数据
74
+      this.postData.OrgId = this.OrgId
75
+      if (this.postData.CaseId === '') this.postData.CaseId = this.CaseId
76
+      this.$ajax(this.$api.system.addGoodsSpec.url, {
77
+        method: this.$api.system.addGoodsSpec.method,
78
+        data: this.postData
79
+      }).then(res => {
80
+        this.$message({
81
+          type: 'success',
82
+          message: '操作成功'
83
+        })
84
+        this.$router.push({ name: 'goodsSpecManager' })
85
+      })
40
     },
86
     },
41
     cancel () {
87
     cancel () {
42
-      this.$router.go(-1)
88
+      this.$router.push({ name: 'goodsSpecManager' })
43
     }
89
     }
44
   },
90
   },
45
   mounted () { }
91
   mounted () { }

+ 11
- 4
src/pages/system/goodsManager/goodsSpecManager/index.vue 查看文件

18
             </el-select>
18
             </el-select>
19
           </li>
19
           </li>
20
         </ul>
20
         </ul>
21
-        <tableSearch @exportSearchKey="searchList"></tableSearch>
21
+        <el-button
22
+          size="mini"
23
+          type="primary" @click="getList">搜索</el-button>
22
       </div>
24
       </div>
23
       <div class="moreFilter"></div>
25
       <div class="moreFilter"></div>
24
     </div>
26
     </div>
91
     tableSearch,
93
     tableSearch,
92
   },
94
   },
93
   methods: {
95
   methods: {
96
+    getList () {
97
+      this.$ajax(this.$api.system.getGoodsSpecList.url, {
98
+        method: this.$api.system.getGoodsSpecList.method,
99
+        data: this.tableSearch
100
+      }).then(res => {
101
+        console.log(JSON.stringify(res))
102
+      })
103
+    },
94
     handleSizeChange (val) {
104
     handleSizeChange (val) {
95
       console.log(`每页 ${val} 条`)
105
       console.log(`每页 ${val} 条`)
96
     },
106
     },
119
         })
129
         })
120
       })
130
       })
121
     },
131
     },
122
-    searchList (key) { // 搜索列表
123
-      console.log(key)
124
-    },
125
     addGoodsSpec () {
132
     addGoodsSpec () {
126
       this.$router.push({ name: 'addGoodsSpec' })
133
       this.$router.push({ name: 'addGoodsSpec' })
127
     }
134
     }

+ 3
- 4
src/store/app.js 查看文件

60
       // 扁平 routerData
60
       // 扁平 routerData
61
       // 同时构造出 含有 title 的 parent 数据
61
       // 同时构造出 含有 title 的 parent 数据
62
       const routeList = flatten([], routerData[1].children, state.menusRaw)
62
       const routeList = flatten([], routerData[1].children, state.menusRaw)
63
-      console.log(state, routerData[1].children, routeList)
63
+      // console.log(state, routerData[1].children, routeList)
64
 
64
 
65
       // 过滤出与 name 相同的 route 节点
65
       // 过滤出与 name 相同的 route 节点
66
       const currentRoute = routeList.filter(x => x.Url === Url)[0]
66
       const currentRoute = routeList.filter(x => x.Url === Url)[0]
73
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
73
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
74
       this.$ajax(this.$api.system.init.url, {
74
       this.$ajax(this.$api.system.init.url, {
75
         method: this.$api.system.init.method
75
         method: this.$api.system.init.method
76
+      }).then(res => {
77
+        context.commit('init', res)
76
       })
78
       })
77
-        .then(res => {
78
-          context.commit('init', res)
79
-        })
80
     }
79
     }
81
   }
80
   }
82
 }
81
 }

+ 14
- 2
src/util/api.js 查看文件

6
       url: `${baseUrl}/guest/signin`
6
       url: `${baseUrl}/guest/signin`
7
     }
7
     }
8
   },
8
   },
9
-  system: { // 初始化菜单
10
-    init: {
9
+  system: {
10
+    init: { // 初始化菜单
11
       method: 'get',
11
       method: 'get',
12
       url: `${baseUrl}/common/system/env`
12
       url: `${baseUrl}/common/system/env`
13
+    },
14
+    getGoodsSpecList: { // 商品规格列表
15
+      method: 'get',
16
+      url: `${baseUrl}/common/spec/goods`
17
+    },
18
+    addGoodsSpec: { // 新增商品规格
19
+      method: 'POST',
20
+      url: `${baseUrl}/common/spec/goods`
21
+    },
22
+    editGoodsSpec: { // 编辑商品规格
23
+      method: 'put',
24
+      url: `${baseUrl}/common/spec/goods`
13
     }
25
     }
14
   },
26
   },
15
   cms: {
27
   cms: {