同步接口

This commit is contained in:
余同学 2024-08-20 18:00:08 +08:00
parent 29a1e65e76
commit 4800553a0f
3 changed files with 131 additions and 118 deletions

View File

@ -2,108 +2,128 @@ import $http from "@/utils/httpRequest.js";
import city_data from "@/utils/country-level2-data.js"; import city_data from "@/utils/country-level2-data.js";
export const mer_admin = { export const mer_admin = {
/** /**
* 登录 * 登录
* @param {object} params LoginParam * @param {object} params LoginParam
* @param {number} params.type * @param {number} params.type
* @param {string} params.role * @param {string} params.role
* @param {string} params.username * @param {string} params.username
* @param {string} params.password * @param {string} params.password
* @param {string} params.mobile * @param {string} params.mobile
* @param {string} params.code * @param {string} params.code
* @returns * @returns
*/ */
loginByAccount: (params) => { loginByAccount: (params) => {
return $http.post(`/auth/login`, { return $http.post(`/auth/login`, {
...params, ...params,
type: 1 type: 1,
}) });
}, },
loginByMobile: (params) => { loginByMobile: (params) => {
return $http.post(`/merchant-api/auth/sms/login`, { return $http.post(`/merchant-api/auth/sms/login`, {
...params, ...params,
type: 2 type: 2,
}) });
}, },
getYZM(mobile) { getYZM(mobile) {
return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`); return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`);
}, },
getInfo() { getInfo() {
return $http.get(`/merchant-api/auth/info`); return $http.get(`/merchant-api/auth/info`);
}, },
//商品管理 //商品管理
//保存商品信息 //保存商品信息
saveProduct: (data) => { saveProduct: (data) => {
return $http.post(`/merchant-api/product/save`, data); return $http.post(`/merchant-api/product/save`, data);
}, },
//保存商品基本信息 //保存商品基本信息
saveProductBase: (data) => { saveProductBase: (data) => {
return $http.post(`/merchant-api/product/save/basic`, data); return $http.post(`/merchant-api/product/save/basic`, data);
}, },
//返回商品分类以及列表(聚合) //返回商品分类以及列表(聚合)
getPolyProduct: (data) => { getPolyProduct: (data) => {
return $http.post(`/merchant-api/product/polymerization/list`, data); return $http.post(`/merchant-api/product/polymerization/list`, data);
}, },
//商品分页 //商品分页
getProductPage: (data) => { getProductPage: (data) => {
return $http.post(`/merchant-api/product/page`, data); return $http.post(`/merchant-api/product/page`, data);
}, },
//商户商品分类 //商户商品分类
getProductCategory: () => { getProductCategory: () => {
return $http.get(`/merchant-api/product/category/list?shopId=${JSON.parse(sessionStorage.getItem('userInfo')).shopId}`); return $http.get(
}, `/merchant-api/product/category/list?shopId=${
//获取销售单位 JSON.parse(sessionStorage.getItem("userInfo")).shopId
getSaleUnit: (data) => { }`
return $http.request({ url: `/merchant-api/product/unit/list`, method: 'get', params: data }); );
}, },
//文件上传 //上架或下架
uploadFile: () => { putOnShelvesProducts: (data) => {
return `${window.SITE_CONFIG['baseUrl']}/merchant-api/file/upload` return $http.post(`/merchant-api/product/batch/update/status`, data);
}, },
//直接获取城市数据 //批量删除商品
getCityOptions: () => { BatchDeleteProducts: (data) => {
return city_data; return $http.post(`/merchant-api/product/batch/delete`, data);
}, },
//省市县数据 //打折扣
getCity: () => { setDiscounts: (data) => {
return $http.get(`/merchant-api/common/pca`); return $http.post(`merchant-api/activity/save`, data);
}, },
//添加运费模板 //获取销售单位
addShippingTemplate: (data) => { getSaleUnit: (data) => {
return $http.post(`/merchant-api/shippingTemplates/add`, data); return $http.request({
}, url: `/merchant-api/product/unit/list`,
//删除模板 method: "get",
removeShippingTemplate: (id) => { params: data,
return $http.post(`/merchant-api/shippingTemplates/delete`, { });
id },
}) //文件上传
}, uploadFile: () => {
//更新模板 return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`;
updateShippingTemplate: (data) => { },
return $http.post(`/merchant-api/shippingTemplates/update`, data); //直接获取城市数据
}, getCityOptions: () => {
//获取模板分页 return city_data;
getShippingTemplatePage: (data) => { },
return $http.request({ //省市县数据
method: 'get', getCity: () => {
url: '/merchant-api/shippingTemplates/page', return $http.get(`/merchant-api/common/pca`);
params: data },
}) //添加运费模板
}, addShippingTemplate: (data) => {
//获取配送模板列表 return $http.post(`/merchant-api/shippingTemplates/add`, data);
getShippingTemplateList: (data) => { },
return $http.request({ //删除模板
method: 'get', removeShippingTemplate: (id) => {
url: '/merchant-api/shippingTemplates/list', return $http.post(`/merchant-api/shippingTemplates/delete`, {
params: data id,
}) });
}, },
//获取模板详情 //更新模板
getShippingTemplateInfo: (id) => { updateShippingTemplate: (data) => {
return $http.request({ return $http.post(`/merchant-api/shippingTemplates/update`, data);
method: 'get', },
url: '/merchant-api/shippingTemplates/list', //获取模板分页
params: { id } 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/list",
params: { id },
});
},
};

View File

@ -29,7 +29,6 @@
placeholder="商品搜索" placeholder="商品搜索"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="$refs.oTable.reload()" <el-button type="primary" @click="$refs.oTable.reload()"
>查询</el-button >查询</el-button
@ -92,6 +91,7 @@ export default {
border: true, border: true,
height: "auto", height: "auto",
"row-id": "id", "row-id": "id",
"show-overflow": false,
}, },
productFilterType: "SALE", productFilterType: "SALE",
selectList: [], selectList: [],
@ -112,6 +112,7 @@ export default {
type: "warning", type: "warning",
}) })
.then(() => { .then(() => {
console.log("111");
this.$api.mer_admin.BatchDeleteProducts(integers).then((res) => { this.$api.mer_admin.BatchDeleteProducts(integers).then((res) => {
this.$refs.oTable.reload(); this.$refs.oTable.reload();
}); });

View File

@ -187,16 +187,7 @@ export default {
productIntroducePhoto: "", productIntroducePhoto: "",
productPhotoList: [], productPhotoList: [],
productPlace: "", productPlace: "",
productSpecificationList: [ productSpecificationList: [],
{
attributeValue: "默认",
costPrice: 20,
salePrice: 30,
stockNum: 10,
weight: 1,
volume: 0.3,
},
],
productUnit: "", productUnit: "",
productVideo: "", productVideo: "",
shelfLife: "", shelfLife: "",
@ -657,9 +648,10 @@ export default {
v-model={this.place} v-model={this.place}
onChange={change} onChange={change}
options={this.$api.mer_admin.getCityOptions()} options={this.$api.mer_admin.getCityOptions()}
{...{ props={{
props: { props: {
checkStrictly: true, label: "name",
value: "name",
}, },
}} }}
clearable clearable