许成详 6 years ago
parent
commit
0b88efe91a

+ 3
- 2
src/pages/system/goodsManager/goodsSpecManager/edit.vue View File

45
     getInfo () { // 获取规格信息
45
     getInfo () { // 获取规格信息
46
       this.$ajax(this.$api.goodsManager.getGoodsSpecById.url, {
46
       this.$ajax(this.$api.goodsManager.getGoodsSpecById.url, {
47
         method: this.$api.goodsManager.getGoodsSpecById.method,
47
         method: this.$api.goodsManager.getGoodsSpecById.method,
48
-        data: { id: this.$route.query.id }
48
+        urlData: {id: this.$route.query.id}
49
       }).then(res => {
49
       }).then(res => {
50
         this.postData = res
50
         this.postData = res
51
       })
51
       })
60
       }
60
       }
61
       this.$ajax(this.$api.goodsManager.editGoodsSpec.url, {
61
       this.$ajax(this.$api.goodsManager.editGoodsSpec.url, {
62
         method: this.$api.goodsManager.editGoodsSpec.method,
62
         method: this.$api.goodsManager.editGoodsSpec.method,
63
-        data: this.postData
63
+        data: this.postData,
64
+        urlData: {id: this.postData.SpecId}
64
       }).then(res => {
65
       }).then(res => {
65
         this.$message({
66
         this.$message({
66
           type: 'success',
67
           type: 'success',

+ 12
- 6
src/pages/system/goodsManager/goodsSpecManager/index.vue View File

115
       this.getList()
115
       this.getList()
116
     },
116
     },
117
     handleEdit (index, row) { // 编辑
117
     handleEdit (index, row) { // 编辑
118
-      this.$router.push({ name: 'editGoodsSpec', query: {id: row.SpecId} })
118
+      this.$router.push({ name: 'editGoodsSpec', query: { id: row.SpecId } })
119
     },
119
     },
120
     handleDelete (index, row) { // 删除
120
     handleDelete (index, row) { // 删除
121
-      console.log(index, row)
122
-      this.$confirm('确认删除此渠道?', '提示', {
121
+      let name = '确认删除规格“' + row.SpecName + '”?'
122
+      this.$confirm(name, '提示', {
123
         confirmButtonText: '确定',
123
         confirmButtonText: '确定',
124
         cancelButtonText: '取消',
124
         cancelButtonText: '取消',
125
         type: 'warning'
125
         type: 'warning'
126
       }).then(() => {
126
       }).then(() => {
127
-        this.$message({
128
-          type: 'success',
129
-          message: '删除成功!'
127
+        this.$ajax(this.$api.goodsManager.deleteGoodsSpec.url, {
128
+          method: this.$api.goodsManager.deleteGoodsSpec.method,
129
+          urlData: { id: row.SpecId }
130
+        }).then(res => {
131
+          this.$message({
132
+            type: 'success',
133
+            message: '删除成功!'
134
+          })
135
+          this.search()
130
         })
136
         })
131
       }).catch(() => {
137
       }).catch(() => {
132
         this.$message({
138
         this.$message({

+ 4
- 0
src/util/api.js View File

28
     editGoodsSpec: { // 编辑商品规格
28
     editGoodsSpec: { // 编辑商品规格
29
       method: 'put',
29
       method: 'put',
30
       url: `${baseUrl}/common/spec/goods/:id`
30
       url: `${baseUrl}/common/spec/goods/:id`
31
+    },
32
+    deleteGoodsSpec: { // 删除商品规格
33
+      method: 'DELETE',
34
+      url: `${baseUrl}/common/spec/goods/:id`
31
     }
35
     }
32
   },
36
   },
33
   cms: {
37
   cms: {