Compare commits

..

No commits in common. "dd5a2e46c92e1cb3b0b07dfb35e09a42fda3e0a8" and "4800553a0f8b2f9a9308321e673165620647071a" have entirely different histories.

3 changed files with 380 additions and 328 deletions

View File

@ -2,120 +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
putOnShelvesProducts: (data) => { }`
return $http.post(`/merchant-api/product/batch/update/status`, data); );
}, },
//批量删除商品 //上架或下架
BatchDeleteProducts: (data) => { putOnShelvesProducts: (data) => {
return $http.post(`/merchant-api/product/batch/delete`, data); return $http.post(`/merchant-api/product/batch/update/status`, data);
}, },
//打折扣 //批量删除商品
setDiscounts: (data) => { BatchDeleteProducts: (data) => {
return $http.post(`merchant-api/activity/save`, data); return $http.post(`/merchant-api/product/batch/delete`, data);
}, },
//获取销售单位 //打折扣
getSaleUnit: (data) => { setDiscounts: (data) => {
return $http.request({ url: `/merchant-api/product/unit/list`, method: 'get', params: data }); return $http.post(`merchant-api/activity/save`, data);
}, },
//文件上传 //获取销售单位
uploadFile: () => { getSaleUnit: (data) => {
return `${window.SITE_CONFIG['baseUrl']}/merchant-api/file/upload` return $http.request({
}, url: `/merchant-api/product/unit/list`,
//直接获取城市数据 method: "get",
getCityOptions: () => { params: data,
return city_data; });
}, },
//省市县数据 //文件上传
getCity: () => { uploadFile: () => {
return $http.get(`/merchant-api/common/pca`); return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`;
}, },
//添加运费模板 //直接获取城市数据
addShippingTemplate: (data) => { getCityOptions: () => {
return $http.post(`/merchant-api/shippingTemplates/add`, data); return city_data;
}, },
//删除模板 //省市县数据
removeShippingTemplate: (id) => { getCity: () => {
return $http.post(`/merchant-api/shippingTemplates/delete`, { return $http.get(`/merchant-api/common/pca`);
id },
}) //添加运费模板
}, addShippingTemplate: (data) => {
//更新模板 return $http.post(`/merchant-api/shippingTemplates/add`, data);
updateShippingTemplate: (data) => { },
return $http.post(`/merchant-api/shippingTemplates/update`, data); //删除模板
}, removeShippingTemplate: (id) => {
//获取模板分页 return $http.post(`/merchant-api/shippingTemplates/delete`, {
getShippingTemplatePage: (data) => { id,
return $http.request({ });
method: 'get', },
url: '/merchant-api/shippingTemplates/page', //更新模板
params: data updateShippingTemplate: (data) => {
}) return $http.post(`/merchant-api/shippingTemplates/update`, data);
}, },
//获取配送模板列表 //获取模板分页
getShippingTemplateList: (data) => { getShippingTemplatePage: (data) => {
return $http.request({ return $http.request({
method: 'get', method: "get",
url: '/merchant-api/shippingTemplates/list', url: "/merchant-api/shippingTemplates/page",
params: data params: data,
}) });
}, },
//获取模板详情 //获取配送模板列表
getShippingTemplateInfo: (id) => { getShippingTemplateList: (data) => {
return $http.request({ return $http.request({
method: 'get', method: "get",
url: '/merchant-api/shippingTemplates/detail', url: "/merchant-api/shippingTemplates/list",
params: { id } params: data,
}) });
} },
} //获取模板详情
getShippingTemplateInfo: (id) => {
return $http.request({
method: "get",
url: "/merchant-api/shippingTemplates/list",
params: { id },
});
},
};

View File

@ -11,12 +11,9 @@
<div slot="tableTop" class="mb-2"> <div slot="tableTop" class="mb-2">
<el-form inline> <el-form inline>
<el-form-item label="模板名称:"> <el-form-item label="模板名称:">
<el-input <el-input placeholder="请输入模板名称"></el-input>
placeholder="请输入模板名称"
v-model="searchForm.name"
></el-input>
</el-form-item> </el-form-item>
<el-button type="primary" @click="$refs.oTable.reload();">搜索</el-button> <el-button type="primary">搜索</el-button>
</el-form> </el-form>
<el-button type="primary" @click="addFareTemplate" <el-button type="primary" @click="addFareTemplate"
>添加运费模板</el-button >添加运费模板</el-button
@ -34,26 +31,223 @@ export default {
data() { data() {
return { return {
dataList: [], dataList: [],
searchForm: {
name: "",
},
}; };
}, },
methods: { methods: {
queryList(pageNo, pageSize) { queryList(pageNo, pageSize) {
this.$api.mer_admin setTimeout(() => {
.getShippingTemplatePage({ this.$refs.oTable.complete([
pageNumber: pageNo, {
pageSize: pageSize, templateName: "运费模板名称(全国包邮)",
...this.searchForm, lastEditTime: "2022-02-15 12:02",
}) tableData: [
.then((res) => { {
console.log(res); a: "中国",
this.$refs.oTable.complete(res.data.data.data,Number(res.data.data.total)); b: 1,
}) c: 0.0,
.catch(err=>{ d: 1,
this.$refs.oTable.complete(false); e: 0.0,
}) },
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
{
templateName: "运费模板名称(全国包邮)",
lastEditTime: "2022-02-15 12:02",
tableData: [
{
a: "中国",
b: 1,
c: 0.0,
d: 1,
e: 0.0,
},
],
},
]);
}, 1000);
}, },
addFareTemplate() { addFareTemplate() {
this.$refs.addTemplate.toggle().add(); this.$refs.addTemplate.toggle().add();
@ -66,22 +260,13 @@ export default {
type: "jsx", type: "jsx",
render: (row) => { render: (row) => {
console.log(row); console.log(row);
this.$api.mer_admin.getShippingTemplateInfo(row.id)
.then(res=>{
console.log(res);
// this.$set(row,tableData,);
})
const appointMapper={
0:'(全国包邮)',
1:'(部分包邮)',
2:'(自定义运费)'
}
return ( return (
<div class="mb-5"> <div class="mb-5">
<div class="flex justify-between items-center bg-gray-100 px-4"> <div class="flex justify-between items-center bg-gray-100 px-4">
<div>{row.name}{appointMapper[row.appoint]}</div> <div>{row.templateName}</div>
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div class="mr-5">最后编辑时间{row.updateTime}</div> <div class="mr-5">最后编辑时间{row.lastEditTime}</div>
<div> <div>
<el-button type="text">复制模板</el-button> <el-button type="text">复制模板</el-button>
<el-button type="text">修改</el-button> <el-button type="text">修改</el-button>

View File

@ -67,43 +67,6 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
computedCityOptions() {
function filterTree(tree, filterArray) {
return tree
.filter((node) => !filterArray.includes(node.code)) //
.map((node) => {
//
const filteredChildren = filterTree(
node.children || [],
filterArray
);
//
const newNode = {
...node,
// children
...(filteredChildren.length > 0 && {
children: filteredChildren,
}),
};
return newNode;
});
}
let selectedArray = [];
for (let item of this.modalData.shippingTemplatesRegionListAppend) {
console.log(item);
selectedArray = selectedArray.concat(item.cityCodes);
}
console.log("执行", selectedArray);
console.log(
"过滤后",
filterTree(this.$api.mer_admin.getCityOptions(), selectedArray)
);
return filterTree(this.$api.mer_admin.getCityOptions(), selectedArray);
},
toggle(e) { toggle(e) {
if (this.modalConfig.show == false) { if (this.modalConfig.show == false) {
this.modalConfig.show = true; this.modalConfig.show = true;
@ -118,7 +81,7 @@ export default {
add: (item) => { add: (item) => {
console.log(item); console.log(item);
this.$nextTick(() => { this.$nextTick(() => {
this.modalData = JSON.parse(JSON.stringify(BASE_DATA)); this.modalData = BASE_DATA;
}); });
this.isAdd = true; this.isAdd = true;
}, },
@ -138,8 +101,6 @@ export default {
prop: "templateName", prop: "templateName",
type: "Input", type: "Input",
maxlength: "30", maxlength: "30",
width: "300px",
clearable: true,
placeholder: "请输入模板名称", placeholder: "请输入模板名称",
rules: { rules: {
required: true, required: true,
@ -184,7 +145,6 @@ export default {
); );
}, },
}, },
//
{ {
label: "自定义运费配置", label: "自定义运费配置",
type: "jsx-out", type: "jsx-out",
@ -196,58 +156,35 @@ export default {
width: "300px", width: "300px",
field: "cityCodes", field: "cityCodes",
type: "jsx", type: "jsx",
render: ({ row, $rowIndex }) => { render: ({ row }) => {
const change = (e) => { const change = (e) => {
console.log(e); console.log(e);
console.log(
this.$refs.cityCode
.getCheckedNodes()
.filter((item) => !(item.parent && item.parent.checked))
);
}; };
return ( return (
<el-form-item <el-cascader
label-width="0" style="width:100%;"
prop={ v-model={row.cityCodes}
"shippingTemplatesRegionListAppend." + onChange={change}
$rowIndex + options={this.$api.mer_admin.getCityOptions()}
".cityCodes" show-all-levels={false}
} collapse-tags={true}
rules={{ props={{
required: true, props: {
message: "请选择运送城市", multiple: true,
checkStrictly: false,
emitPath: true,
label: "name",
value: "code",
},
}} }}
> clearable
<el-cascader filterable
ref="cityCode" ></el-cascader>
style="width:100%;"
v-model={row.cityCodes}
onChange={change}
options={this.$api.mer_admin.getCityOptions()}
show-all-levels={false}
collapse-tags={true}
placeholder="点击选择运送城市"
props={{
props: {
multiple: true,
checkStrictly: false,
emitPath: false,
label: "name",
value: "code",
},
}}
clearable
filterable
></el-cascader>
</el-form-item>
); );
}, },
}, },
{ {
title: title: "首重kg",
this.modalData.calculateMethod == "按重量"
? "首重kg"
: "首件(个)",
field: "first", field: "first",
type: "jsx", type: "jsx",
render: ({ row }) => { render: ({ row }) => {
@ -256,9 +193,7 @@ export default {
style="width:100%;" style="width:100%;"
min={0} min={0}
controls={false} controls={false}
precision={ precision={2}
this.modalData.calculateMethod == "按重量" ? 2 : 0
}
v-model={row.first} v-model={row.first}
></el-input-number> ></el-input-number>
); );
@ -281,10 +216,7 @@ export default {
}, },
}, },
{ {
title: title: "续重kg",
this.modalData.calculateMethod == "按重量"
? "续重kg"
: "续件数(个)",
field: "renewal", field: "renewal",
type: "jsx", type: "jsx",
render: ({ row }) => { render: ({ row }) => {
@ -293,9 +225,7 @@ export default {
style="width:100%;" style="width:100%;"
min={0} min={0}
controls={false} controls={false}
precision={ precision={2}
this.modalData.calculateMethod == "按重量" ? 2 : 0
}
v-model={row.renewal} v-model={row.renewal}
></el-input-number> ></el-input-number>
); );
@ -387,23 +317,14 @@ export default {
}} }}
label="默认运费" label="默认运费"
> >
<el-input-number <el-input
v-model={ v-model={
this.modalData.shippingTemplatesRegionList[0].first this.modalData.shippingTemplatesRegionList[0].first
} }
min={0} ></el-input>
controls={false}
precision={
this.modalData.calculateMethod == "按重量" ? 2 : 0
}
></el-input-number>
</el-form-item> </el-form-item>
<span style="transform:translateY(-12px);"> <span style="transform:translateY(-12px);">
&nbsp; &nbsp;kg内&nbsp;
{this.modalData.calculateMethod == "按重量"
? "kg内"
: "件内"}
&nbsp;
</span> </span>
<el-form-item <el-form-item
label-width="0" label-width="0"
@ -415,14 +336,11 @@ export default {
}} }}
label="" label=""
> >
<el-input-number <el-input
v-model={ v-model={
this.modalData.shippingTemplatesRegionList[0].firstPrice this.modalData.shippingTemplatesRegionList[0].firstPrice
} }
min={0} ></el-input>
controls={false}
precision={2}
></el-input-number>
</el-form-item> </el-form-item>
<span style="transform:translateY(-12px);"> <span style="transform:translateY(-12px);">
&nbsp;每增加&nbsp; &nbsp;每增加&nbsp;
@ -437,21 +355,14 @@ export default {
}} }}
label="" label=""
> >
<el-input-number <el-input
v-model={ v-model={
this.modalData.shippingTemplatesRegionList[0].renewal this.modalData.shippingTemplatesRegionList[0].renewal
} }
min={0} ></el-input>
controls={false}
precision={
this.modalData.calculateMethod == "按重量" ? 2 : 0
}
></el-input-number>
</el-form-item> </el-form-item>
<span style="transform:translateY(-12px);"> <span style="transform:translateY(-12px);">
&nbsp; &nbsp;kg增加运费&nbsp;
{this.modalData.calculateMethod == "按重量" ? "kg" : "件"}
增加运费&nbsp;
</span> </span>
<el-form-item <el-form-item
label-width="0" label-width="0"
@ -463,15 +374,12 @@ export default {
}} }}
label="" label=""
> >
<el-input-number <el-input
min={0}
controls={false}
precision={2}
v-model={ v-model={
this.modalData.shippingTemplatesRegionList[0] this.modalData.shippingTemplatesRegionList[0]
.renewalPrice .renewalPrice
} }
></el-input-number> ></el-input>
</el-form-item> </el-form-item>
<span style="transform:translateY(-12px);"> <span style="transform:translateY(-12px);">
&nbsp;&nbsp; &nbsp;&nbsp;
@ -529,7 +437,7 @@ export default {
props: { props: {
multiple: true, multiple: true,
checkStrictly: false, checkStrictly: false,
emitPath: false, emitPath: true,
label: "name", label: "name",
value: "code", value: "code",
}, },
@ -594,7 +502,7 @@ export default {
return ( return (
<div class="flex justify-start items-center"> <div class="flex justify-start items-center">
<el-select <el-select
style="width:120px;" style="width:80px;"
v-model={row.conditionType} v-model={row.conditionType}
> >
<el-option label="件数" value="件数"></el-option> <el-option label="件数" value="件数"></el-option>
@ -694,56 +602,7 @@ export default {
type: "primary", type: "primary",
loading: this.isLoading, loading: this.isLoading,
submit: true, submit: true,
handle: debounce(() => { handle: debounce(() => {}, 300),
console.log(this.modalData);
if (this.isAdd) {
this.$api.mer_admin.addShippingTemplate({
linkId: JSON.parse(sessionStorage.getItem("userInfo")).shopId,
defaults: 0,//
sort: 0,//
type:2,//
name: this.modalData.templateName,
groups: {
按重量: 2,
按件数: 1,
按体积: 3,
}[this.modalData.calculateMethod],
appoint: {
全国包邮: 0,
自定义运费: 2,
}[this.modalData.fareConfig],
shippingTemplatesRegionList:
this.modalData.fareConfig == "全国包邮"
? null
: [
...this.modalData.shippingTemplatesRegionList,
...JSON.parse(
JSON.stringify(
this.modalData.shippingTemplatesRegionListAppend.map(
(item) => {
item.cityCodes = item.cityCodes.join(",");
return item;
}
)
)
),
],
shippingTemplatesConditionList:
this.modalData.fareConfig == "全国包邮"
? null
: JSON.parse(
JSON.stringify(
this.modalData.shippingTemplatesConditionList.map(
(item) => {
item.cityCodes = item.cityCodes.join(",");
return item;
}
)
)
),
});
}
}, 300),
}, },
]; ];
}, },