Refactor billing options retrieval to include data permissions and add effective date handling for product imports
This commit is contained in:
@@ -9,6 +9,15 @@ export function listProduct(query) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 产品下拉选项(非分页,不要求 price:product:list 权限) */
|
||||
export function listProductOptions(query) {
|
||||
return request({
|
||||
url: '/price/product/optionselect',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询产品详情 */
|
||||
export function getProduct(productId) {
|
||||
return request({
|
||||
@@ -111,13 +120,17 @@ async function pollProductImportTask(taskId, onProgress) {
|
||||
/**
|
||||
* Async all-country product import; poll until done.
|
||||
* @param {File|Blob} file
|
||||
* @param {string} effectiveDate yyyy-MM-dd (required)
|
||||
* @param {(task: object) => void} [onProgress]
|
||||
*/
|
||||
export async function importProductExcelAsync(file, onProgress) {
|
||||
export async function importProductExcelAsync(file, effectiveDate, onProgress) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const params = new URLSearchParams()
|
||||
params.set('updateSupport', '0')
|
||||
if (effectiveDate) params.set('effectiveDate', effectiveDate)
|
||||
const submitRes = await request({
|
||||
url: '/price/product/importData?updateSupport=0',
|
||||
url: '/price/product/importData?' + params.toString(),
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
@@ -133,13 +146,15 @@ export async function importProductExcelAsync(file, onProgress) {
|
||||
* Async single-country product import; poll until done.
|
||||
* @param {File|Blob} file
|
||||
* @param {string} countryCode
|
||||
* @param {string} effectiveDate yyyy-MM-dd
|
||||
* @param {(task: object) => void} [onProgress]
|
||||
*/
|
||||
export async function importProductCountryExcelAsync(file, countryCode, onProgress) {
|
||||
export async function importProductCountryExcelAsync(file, countryCode, effectiveDate, onProgress) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const params = new URLSearchParams()
|
||||
params.set('countryCode', countryCode)
|
||||
if (effectiveDate) params.set('effectiveDate', effectiveDate)
|
||||
const submitRes = await request({
|
||||
url: '/price/product/importCountryData?' + params.toString(),
|
||||
method: 'post',
|
||||
|
||||
@@ -128,6 +128,14 @@ export function copyPriceSetVersion(psvId) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Create empty draft version under package */
|
||||
export function createPriceSetVersion(priceSetId) {
|
||||
return request({
|
||||
url: '/price/set/version/create/' + priceSetId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePriceSetVersion(psvId) {
|
||||
return request({
|
||||
url: '/price/set/version/' + psvId,
|
||||
|
||||
Reference in New Issue
Block a user