java-mall-admin/src/api/goodsTool.js
2025-12-30 11:58:09 +08:00

233 lines
5.2 KiB
JavaScript

import request from '@/utils/request'
import { stringify } from 'qs'
export async function getProductMapperList(data) {
data = stringify(data)
return request({
url: `/admin/shop/shop-sync-productMapper/list?${data}`,
method: 'get',
})
}
export async function getShopList() {
return request({
url: '/admin/shop/shop-store-base/list?pageNum=1&pageSize=99999&store_type=1',
method: 'get',
})
}
export async function updateGoods(data) {
return request({
url: '/admin/shop/shop-sync-productMapper/udpateProductMapping',
method: 'put',
headers: {
'Content-Type': 'application/json',
},
data,
})
}
export async function deleteGoods(data) {
return request({
url: '/admin/shop/shop-sync-productMapper/delProductMapping',
method: 'delete',
headers: {
'Content-Type': 'application/json',
},
data,
})
}
export async function downloadTempGoods() {
return request({
url: '/admin/shop/shop-sync-productMapper/template',
method: 'get',
responseType: 'blob',
})
}
//商品导入 下载三个模板
export async function downloadBrandTemplate() {
return request({
url: '/admin/shop/shop-sync-import/brandTemplate',
method: 'get',
responseType: 'blob',
})
}
export async function downloadCategoryTemplate() {
return request({
url: '/admin/shop/shop-sync-import/categoryTemplate',
method: 'get',
responseType: 'blob',
})
}
export async function downloadGoodsTemplate() {
return request({
url: '/admin/shop/shop-sync-import/shopTemplate',
method: 'get',
responseType: 'blob',
})
}
export async function exportUncheckShopData(storeId) {
return request({
url: '/admin/shop/shop-sync-productMapper/exportUncheckShopData',
method: 'post',
responseType: 'blob',
params: {
storeId: storeId
}
})
}
export async function batchCreateGoods(data) {
return request({
url: '/admin/shop/shop-sync-productMapper/saveProductMappingBatch',
method: 'post',
headers: {
'Content-Type': 'application/json',
},
data,
})
}
export async function batchExportGoods(data) {
const formData = new URLSearchParams();
data.forEach(id => formData.append('ids', id));
return request({
url: '/admin/shop/shop-sync-productMapper/exportSelected',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: formData.toString(),
responseType: 'blob'
});
}
export async function getProductMapping(data) {
return request({
url: '/admin/shop/shop-sync-productMapper/getProductMapping',
method: 'get',
data,
})
}
export async function getSyncBaseMapingProducts() {
return request({
url: '/admin/shop/shop-sync-productMapper/getSyncBaseMapingProducts',
method: 'get',
})
}
export async function downloadErrorReport(data) {
data = stringify(data)
return request({
url: `/admin/shop/shop-sync-productMapper/download?${data}`,
method: 'get',
})
}
export async function syncProductMaping(storeId,isPublish) {
return request({
url: `/admin/shop/shop-sync-productMapper/syncProductMaping`,
method: 'put',
headers: {
'Content-Type': 'application/json',
},
params:{
storeId,
isPublish,
}
})
}
export async function importGoodsData(data) {
return request({
url: '/admin/shop/shop-sync-productMapper/importData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
},
data,
})
}
//商品导入的三个导入
export async function categoryImportData(data) {
return request({
url: '/admin/shop/shop-sync-import/categoryImportData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
},
data,
})
}
export async function brandImportData(data) {
return request({
url: '/admin/shop/shop-sync-import/brandImportData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
},
data,
})
}
export async function shopImportData(data) {
return request({
url: '/admin/shop/shop-sync-import/shopImportData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
},
data,
})
}
export async function syncShopImages(data) {
data = stringify(data)
return request({
url: `/admin/shop/shop-sync-productMapper/syncShopImages?${data}`,
method: 'post',
})
}
export async function getImgList(data) {
data = stringify(data)
return request({
url: `/admin/shop/libraryProduct/list?${data}`,
method:'get',
})
}
export async function saveBatchBarcode(data) {
return request({
url:'/admin/shop/libraryProduct/saveBatch',
method:'put',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
export default {
getProductMapperList,
getShopList,
updateGoods,
deleteGoods /* */,
downloadTempGoods,
exportUncheckShopData,
batchCreateGoods,
batchExportGoods,
getProductMapping,
getSyncBaseMapingProducts,
downloadErrorReport,
syncProductMaping,
importGoodsData,
syncShopImages,
getImgList,
saveBatchBarcode,
downloadBrandTemplate,
downloadCategoryTemplate,
downloadGoodsTemplate,
categoryImportData,
brandImportData,
shopImportData
}