2024-08-13 10:03:15 +00:00
|
|
|
import $http from "@/utils/httpRequest.js";
|
|
|
|
import city_data from "@/utils/country-level2-data.js";
|
2024-08-22 04:58:29 +00:00
|
|
|
import qs from "qs";
|
2024-08-07 09:55:31 +00:00
|
|
|
|
|
|
|
export const mer_admin = {
|
2024-09-28 09:12:06 +00:00
|
|
|
/**
|
|
|
|
* 登录
|
|
|
|
* @param {object} params LoginParam
|
|
|
|
* @param {number} params.type
|
|
|
|
* @param {string} params.role
|
|
|
|
* @param {string} params.username
|
|
|
|
* @param {string} params.password
|
|
|
|
* @param {string} params.mobile
|
|
|
|
* @param {string} params.code
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
loginByAccount: (params) => {
|
2024-11-15 08:34:50 +00:00
|
|
|
return $http.post(`/merchant-api/auth/login`, {
|
2024-09-28 09:12:06 +00:00
|
|
|
...params,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
loginByMobile: (params) => {
|
|
|
|
return $http.post(`/merchant-api/auth/sms/login`, {
|
|
|
|
...params,
|
|
|
|
type: 2,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getYZM(mobile) {
|
|
|
|
return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`);
|
|
|
|
},
|
|
|
|
getInfo() {
|
|
|
|
return $http.get(`/merchant-api/auth/info`);
|
|
|
|
},
|
|
|
|
//商品管理
|
|
|
|
//保存商品信息
|
|
|
|
saveProduct: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/save`, data);
|
|
|
|
},
|
|
|
|
//保存商品基本信息
|
|
|
|
saveProductBase: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/save/basic`, data);
|
|
|
|
},
|
|
|
|
//返回商品分类以及列表(聚合)
|
|
|
|
getPolyProduct: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/polymerization/list`, data);
|
|
|
|
},
|
|
|
|
//商品分页
|
|
|
|
getProductPage: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/page`, data);
|
|
|
|
},
|
|
|
|
//商户商品分类
|
|
|
|
getProductCategory: () => {
|
|
|
|
return $http.get(
|
|
|
|
`/merchant-api/product/category/list?shopId=${
|
|
|
|
JSON.parse(sessionStorage.getItem("userInfo")).shopId
|
|
|
|
}`
|
|
|
|
);
|
|
|
|
},
|
|
|
|
//上架或下架
|
|
|
|
putOnShelvesProducts: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/batch/update/status`, data);
|
|
|
|
},
|
|
|
|
//批量删除商品
|
|
|
|
BatchDeleteProducts: (data) => {
|
|
|
|
return $http.post(`/merchant-api/product/batch/delete`, data);
|
|
|
|
},
|
|
|
|
//打折扣
|
|
|
|
setDiscounts: (data) => {
|
|
|
|
return $http.post(`merchant-api/activity/save`, data);
|
|
|
|
},
|
|
|
|
//获取销售单位
|
|
|
|
getSaleUnit: (data) => {
|
|
|
|
return $http.request({
|
|
|
|
url: `/merchant-api/product/unit/list`,
|
|
|
|
method: "get",
|
|
|
|
params: data,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//文件上传
|
|
|
|
uploadFile: () => {
|
|
|
|
return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`;
|
|
|
|
},
|
|
|
|
//直接获取城市数据
|
|
|
|
getCityOptions: () => {
|
|
|
|
return city_data;
|
|
|
|
},
|
|
|
|
//省市县数据
|
|
|
|
getCity: () => {
|
|
|
|
return $http.get(`/merchant-api/common/pca`);
|
|
|
|
},
|
|
|
|
//添加运费模板
|
|
|
|
addShippingTemplate: (data) => {
|
|
|
|
return $http.post(`/merchant-api/shippingTemplates/add`, data);
|
|
|
|
},
|
|
|
|
//删除模板
|
|
|
|
removeShippingTemplate: (id) => {
|
|
|
|
return $http.post(
|
|
|
|
`/merchant-api/shippingTemplates/delete`,
|
|
|
|
qs.stringify({
|
|
|
|
id,
|
|
|
|
}),
|
|
|
|
{
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
//更新模板
|
|
|
|
updateShippingTemplate: (data) => {
|
|
|
|
return $http.post(`/merchant-api/shippingTemplates/update`, data);
|
|
|
|
},
|
|
|
|
//获取模板分页
|
|
|
|
getShippingTemplatePage: (data) => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: "/merchant-api/shippingTemplates/page",
|
|
|
|
params: data,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//获取配送模板列表
|
|
|
|
getShippingTemplateList: (data) => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: "/merchant-api/shippingTemplates/list",
|
|
|
|
params: data,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//获取模板详情
|
|
|
|
getShippingTemplateInfo: (id) => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: "/merchant-api/shippingTemplates/detail",
|
|
|
|
params: { id },
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//银行卡分页
|
|
|
|
bankCardPage: (data) => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: "/merchant-api/bank/page",
|
|
|
|
params: data,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//添加商家端银行卡
|
|
|
|
bankCardAdd: (data) => {
|
|
|
|
return $http.post(`/merchant-api/bank/com-create`, data);
|
|
|
|
},
|
2024-09-29 10:02:11 +00:00
|
|
|
//获取银行卡详情
|
|
|
|
bankCardDetail: (id) => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: "/merchant-api/bank/detail",
|
|
|
|
params: { id },
|
|
|
|
});
|
|
|
|
},
|
2024-11-15 08:34:50 +00:00
|
|
|
//获取品牌信息
|
|
|
|
getBrandInfo: () => {
|
|
|
|
return $http.request({
|
|
|
|
method: "get",
|
|
|
|
url: `/merchant-api/brand/info`,
|
|
|
|
params: {},
|
|
|
|
});
|
|
|
|
},
|
2024-09-28 09:12:06 +00:00
|
|
|
};
|