fix: membership create & update

This commit is contained in:
2021-12-16 21:39:31 +07:00
parent d41681c217
commit ac13d366c8
6 changed files with 51 additions and 11 deletions

View File

@@ -26,21 +26,32 @@ export class Category {
async getData() {
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
console.log(response)
this.data = response.body.data ?? []
this.data = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
}
async getDataSubCategories() {
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
this.dataSubCategories = response.body.data ?? []
this.dataSubCategories = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_dataSubCategories = response.body.count ?? 0
}
async getDataCategories() {
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
this.dataCategories = response.body.data ?? []
this.dataCategories = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_dataCategories = response.body.total_data ?? 0
if (this.dataCategories.length > 0) {
this.filterCategory = this.dataCategories[0].id

View File

@@ -18,6 +18,7 @@ export class Membership {
this.data = response.body.data.map((item, idx) => {
item.key = idx;
item.name = item?.user_detail?.name;
item.phone_number = item?.user_detail?.phone_number;
item.roleId = item?.roles.id;
item.roleName = item?.roles.name;
return item
@@ -33,6 +34,7 @@ export class Membership {
this.data = response.body.data.map((item, idx) => {
item.key = idx;
item.name = item?.user_detail?.name;
item.phone_number = item?.user_detail?.phone_number;
item.roleId = item?.roles.id;
item.roleName = item?.roles?.name;
return item

View File

@@ -26,13 +26,22 @@ export class Subcategory {
async getData() {
const response = await http.get(`/product/sub-categories?page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data ?? []
this.data = response.body.data.map((item, idx) => {
item.key = idx;
item.categoryName = item.category.name;
return item
}) ?? []
this.total_data = response.body.total_data ?? 0
}
async getDataSubCategories() {
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
this.dataSubCategories = response.body.data ?? []
this.dataSubCategories = response.body.data.map((item, idx) => {
item.key = idx;
return item
}) ?? []
this.total_dataSubCategories = response.body.count ?? 0
}