Config Page

This commit is contained in:
2021-12-23 15:06:46 +07:00
parent 4ba8f07f93
commit 8ead48ad2a
11 changed files with 463 additions and 182 deletions

View File

@@ -22,6 +22,11 @@ export class Product {
dataSubCategories = [];
total_dataSubCategories = 0;
filterCategory = null;
dataDetail=[]
dataDetailProduct=[]
pageGetDetail=0
supplier=null
constructor(ctx) {
this.ctx = ctx;
@@ -31,7 +36,7 @@ export class Product {
async getData() {
try {
const response = await http.get(`/product/all?supplier=${this.filterSupplier}&sub-category=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`);
//console.log(response)
console.log(response)
this.data = response.body.data.map((item, idx) => {
item.key = idx;
return item
@@ -67,6 +72,26 @@ export class Product {
console.error(e);
}
}
async getDetail(id) {
try {
const response = await http.get(`/product/price-history/${id}?page=${this.pageGetDetail}&supplier=${this.supplier}`);
//console.log(response,' Detail')
this.dataDetail = response.body.data
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}
}
async getDetailProduct(id) {
try {
const response = await http.get(`/product/${id}`);
//console.log(response,' Detail Product')
this.dataDetailProduct = response.body.data
this.total_data = response?.body?.count ?? 0
} catch (e) {
console.error(e);
}
}
async create(data) {
try {