...
|
...
|
@@ -11,7 +11,7 @@ |
|
|
<Page :total="pageData.total" :current="pageData.current"
|
|
|
@on-change="pageChange" :page-size="20" show-total></Page>
|
|
|
</LayoutList>
|
|
|
<EditName ref="showNameEdit"></EditName>
|
|
|
<EditName ref="showNameEdit" @on-success="onEditSuccess"></EditName>
|
|
|
</LayoutBody>
|
|
|
</template>
|
|
|
|
...
|
...
|
@@ -19,30 +19,35 @@ |
|
|
import _ from 'lodash';
|
|
|
import {tableCols, pageData, tableData} from './store';
|
|
|
import components from './components';
|
|
|
import service from 'shop-category-service';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
self: this,
|
|
|
tableCols,
|
|
|
tableData,
|
|
|
tableData: [],
|
|
|
pageData,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData();
|
|
|
},
|
|
|
methods: {
|
|
|
clickEditName(row) {
|
|
|
this.$refs.showNameEdit.show(row)
|
|
|
this.$refs.showNameEdit.update(row)
|
|
|
},
|
|
|
clickDelete(row) {
|
|
|
let _this = this;
|
|
|
|
|
|
this.$Modal.confirm({
|
|
|
title: '删除店铺商品分类',
|
|
|
content: '你确定 删除 商品分类 test 么?',
|
|
|
onOk: function() {
|
|
|
|
|
|
content: `你确定 删除 商品分类 ${row.categoryName} 么?`,
|
|
|
onOk() {
|
|
|
_this.deleteCategory(row.categoryId).then(() => {
|
|
|
_this.tableData.splice(_this.tableData.indexOf(row), 1)
|
|
|
});
|
|
|
},
|
|
|
onCancel: function() {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
clickEditRelation(row) {
|
...
|
...
|
@@ -50,12 +55,33 @@ |
|
|
this.$router.push({name: 'shop.category.edit', query: { categoryId }})
|
|
|
},
|
|
|
clickCreate() {
|
|
|
|
|
|
this.$refs.showNameEdit.create()
|
|
|
},
|
|
|
pageChange() {
|
|
|
|
|
|
},
|
|
|
|
|
|
getData() {
|
|
|
return service.getCategoryList(pageData.current).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.pageData.total = result.data.total;
|
|
|
this.pageData.current = result.data.currentPage;
|
|
|
this.tableData = result.data.rows;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
deleteCategory(id) {
|
|
|
return service.deleteCategory(id).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
return Promise.resolve();
|
|
|
} else {
|
|
|
return Promise.reject();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
onEditSuccess() {
|
|
|
console.log('ok');
|
|
|
this.getData();
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
...components
|
...
|
...
|
|