248 lines
5.9 KiB
JavaScript
248 lines
5.9 KiB
JavaScript
const URL = "/one-api/mockup/masterdata/";
|
|
|
|
export async function search_company(token, search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_company', {
|
|
token:token,
|
|
search:search
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_company_2(token) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_company_2', {
|
|
token:token
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_single_company(token, id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_single_company', {
|
|
token:token,
|
|
id:id
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function copy_price(token, source_id, target_id, disc) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/copy_price', {
|
|
token: token,
|
|
source_id: source_id,
|
|
target_id: target_id,
|
|
disc: disc
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_mou(token, company, query) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_mou', {
|
|
token:token,
|
|
company_id: company,
|
|
search: query
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_price(token, mou, query, page) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_price', {
|
|
token:token,
|
|
mou_id: mou,
|
|
search: query,
|
|
page: page
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function del_price(token, id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/del_price', {
|
|
token:token,
|
|
id: id
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_px(token, query) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_px', {
|
|
token:token,
|
|
search: query
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function save_px(token, datax, datay) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/save_px', {
|
|
token:token,
|
|
data: datax,
|
|
data_others: datay
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function search_addon(token, query) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/search_addon', {
|
|
token:token,
|
|
search: query
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function save_addon(token, name) {
|
|
try {
|
|
var resp = await axios.post(URL + 'price/save_addon', {
|
|
token:token,
|
|
name: name
|
|
});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
} |