Compare commits

..

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

3 changed files with 380 additions and 328 deletions

View File

@ -16,14 +16,14 @@ export const mer_admin = {
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}`);
@ -50,7 +50,11 @@ export const mer_admin = {
}, },
//商户商品分类 //商户商品分类
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) => { putOnShelvesProducts: (data) => {
@ -66,11 +70,15 @@ export const mer_admin = {
}, },
//获取销售单位 //获取销售单位
getSaleUnit: (data) => { getSaleUnit: (data) => {
return $http.request({ url: `/merchant-api/product/unit/list`, method: 'get', params: data }); return $http.request({
url: `/merchant-api/product/unit/list`,
method: "get",
params: data,
});
}, },
//文件上传 //文件上传
uploadFile: () => { uploadFile: () => {
return `${window.SITE_CONFIG['baseUrl']}/merchant-api/file/upload` return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`;
}, },
//直接获取城市数据 //直接获取城市数据
getCityOptions: () => { getCityOptions: () => {
@ -87,8 +95,8 @@ export const mer_admin = {
//删除模板 //删除模板
removeShippingTemplate: (id) => { removeShippingTemplate: (id) => {
return $http.post(`/merchant-api/shippingTemplates/delete`, { return $http.post(`/merchant-api/shippingTemplates/delete`, {
id id,
}) });
}, },
//更新模板 //更新模板
updateShippingTemplate: (data) => { updateShippingTemplate: (data) => {
@ -97,25 +105,25 @@ export const mer_admin = {
//获取模板分页 //获取模板分页
getShippingTemplatePage: (data) => { getShippingTemplatePage: (data) => {
return $http.request({ return $http.request({
method: 'get', method: "get",
url: '/merchant-api/shippingTemplates/page', url: "/merchant-api/shippingTemplates/page",
params: data params: data,
}) });
}, },
//获取配送模板列表 //获取配送模板列表
getShippingTemplateList: (data) => { getShippingTemplateList: (data) => {
return $http.request({ return $http.request({
method: 'get', method: "get",
url: '/merchant-api/shippingTemplates/list', url: "/merchant-api/shippingTemplates/list",
params: data params: data,
}) });
}, },
//获取模板详情 //获取模板详情
getShippingTemplateInfo: (id) => { getShippingTemplateInfo: (id) => {
return $http.request({ return $http.request({
method: 'get', method: "get",
url: '/merchant-api/shippingTemplates/detail', url: "/merchant-api/shippingTemplates/list",
params: { id } 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,42 +156,23 @@ 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
label-width="0"
prop={
"shippingTemplatesRegionListAppend." +
$rowIndex +
".cityCodes"
}
rules={{
required: true,
message: "请选择运送城市",
}}
>
<el-cascader <el-cascader
ref="cityCode"
style="width:100%;" style="width:100%;"
v-model={row.cityCodes} v-model={row.cityCodes}
onChange={change} onChange={change}
options={this.$api.mer_admin.getCityOptions()} options={this.$api.mer_admin.getCityOptions()}
show-all-levels={false} show-all-levels={false}
collapse-tags={true} collapse-tags={true}
placeholder="点击选择运送城市"
props={{ props={{
props: { props: {
multiple: true, multiple: true,
checkStrictly: false, checkStrictly: false,
emitPath: false, emitPath: true,
label: "name", label: "name",
value: "code", value: "code",
}, },
@ -239,15 +180,11 @@ export default {
clearable clearable
filterable filterable
></el-cascader> ></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),
}, },
]; ];
}, },