Compare commits
2 Commits
ffda9f2af2
...
5d4ce160ea
Author | SHA1 | Date |
---|---|---|
KangKang0928 | 5d4ce160ea | |
KangKang0928 | 43b7031ba0 |
|
@ -55,7 +55,7 @@
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"obj-modal": "^1.2.0",
|
"obj-modal": "^1.2.0",
|
||||||
"obj-table-plus": "^2.3.0",
|
"obj-table-plus": "^2.4.0",
|
||||||
"quill": "1.3.7",
|
"quill": "1.3.7",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"signature_pad": "^3.0.0-beta.4",
|
"signature_pad": "^3.0.0-beta.4",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import $http from "@/utils/httpRequest.js";
|
import $http from "@/utils/httpRequest.js";
|
||||||
import city_data from "@/utils/country-level2-data.js";
|
import city_data from "@/utils/country-level2-data.js";
|
||||||
|
import qs from "qs";
|
||||||
|
|
||||||
export const mer_admin = {
|
export const mer_admin = {
|
||||||
/**
|
/**
|
||||||
|
@ -86,8 +87,12 @@ export const mer_admin = {
|
||||||
},
|
},
|
||||||
//删除模板
|
//删除模板
|
||||||
removeShippingTemplate: (id) => {
|
removeShippingTemplate: (id) => {
|
||||||
return $http.post(`/merchant-api/shippingTemplates/delete`, {
|
return $http.post(`/merchant-api/shippingTemplates/delete`, qs.stringify({
|
||||||
id
|
id
|
||||||
|
}), {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//更新模板
|
//更新模板
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
v-model="dataList"
|
v-model="dataList"
|
||||||
@query="queryList"
|
@query="queryList"
|
||||||
>
|
>
|
||||||
|
<template slot="flexEmpty">
|
||||||
|
<el-empty description="暂无数据"></el-empty>
|
||||||
|
</template>
|
||||||
<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="模板名称:">
|
||||||
|
@ -76,8 +79,64 @@ export default {
|
||||||
console.log(row);
|
console.log(row);
|
||||||
this.$api.mer_admin.getShippingTemplateInfo(row.id).then((res) => {
|
this.$api.mer_admin.getShippingTemplateInfo(row.id).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
// this.$set(row,tableData,);
|
console.log("row.tableData", row.tableData);
|
||||||
|
|
||||||
|
if (!row.tableData) {
|
||||||
|
if (res.data.data.shippingTemplatesRegionResultList) {
|
||||||
|
this.$set(
|
||||||
|
row,
|
||||||
|
"tableData",
|
||||||
|
res.data.data.shippingTemplatesRegionResultList.map(
|
||||||
|
(item) => {
|
||||||
|
item.cityCodes = item.cityCodes?.split(",");
|
||||||
|
console.log("item.cityCodes", item.cityCodes);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
//包邮,假数据写死
|
||||||
|
this.$set(row, "tableData", [
|
||||||
|
{
|
||||||
|
cityCodes: "0",
|
||||||
|
first: "1",
|
||||||
|
firstPrice: "0.00",
|
||||||
|
renewal: "1",
|
||||||
|
renewalPrice: "0.00",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
const findLabelsByCode = (tree, codes) => {
|
||||||
|
const labels = [];
|
||||||
|
// console.log("row.cityCodes",row.cityCodes);
|
||||||
|
//全国范围
|
||||||
|
if (codes == "0") {
|
||||||
|
return "中国";
|
||||||
|
}
|
||||||
|
function searchTree(node) {
|
||||||
|
// 如果当前节点的 code 在 codes 数组中,添加其 label
|
||||||
|
if (codes?.includes(node.code)) {
|
||||||
|
labels.push(node.name);
|
||||||
|
}
|
||||||
|
// 如果有子节点,继续递归查找
|
||||||
|
if (node.children) {
|
||||||
|
for (let child of node.children) {
|
||||||
|
searchTree(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对树的每个顶层节点调用 searchTree
|
||||||
|
for (let node of tree) {
|
||||||
|
searchTree(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
return labels.join(",");
|
||||||
|
};
|
||||||
|
|
||||||
const appointMapper = {
|
const appointMapper = {
|
||||||
0: "(全国包邮)",
|
0: "(全国包邮)",
|
||||||
1: "(部分包邮)",
|
1: "(部分包邮)",
|
||||||
|
@ -101,10 +160,25 @@ export default {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const remove = () => {
|
const remove = () => {
|
||||||
this.$api.mer_admin.removeShippingTemplate(row.id)
|
this.$api.mer_admin.removeShippingTemplate(row.id).then((res) => {
|
||||||
.then(res=>{
|
|
||||||
this.$refs.oTable.refresh();
|
this.$refs.oTable.refresh();
|
||||||
})
|
});
|
||||||
|
};
|
||||||
|
const groupMapper = {
|
||||||
|
1: {
|
||||||
|
first: "首件(个)",
|
||||||
|
renewal: "续件(个)",
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
first: "首重(kg)",
|
||||||
|
renewal: "续重(kg)",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
//打开弹窗预览
|
||||||
|
const openPreview = (str) => {
|
||||||
|
this.$confirm(str, "详情", {
|
||||||
|
showCancel: false,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
|
@ -122,7 +196,11 @@ export default {
|
||||||
<el-button type="text" onClick={edit}>
|
<el-button type="text" onClick={edit}>
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popconfirm class="ml-2" title="确认删除模板?" onConfirm={remove}>
|
<el-popconfirm
|
||||||
|
class="ml-2"
|
||||||
|
title="确认删除模板?"
|
||||||
|
onConfirm={remove}
|
||||||
|
>
|
||||||
<el-button type="text" slot="reference">
|
<el-button type="text" slot="reference">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -130,30 +208,59 @@ export default {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<vxe-table border align="center" data={row.tableData}>
|
<vxe-table
|
||||||
|
max-height="300"
|
||||||
|
border
|
||||||
|
align="center"
|
||||||
|
show-overflow
|
||||||
|
data={row.tableData}
|
||||||
|
>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
width="180px"
|
width="180px"
|
||||||
field="a"
|
field="cityCodes"
|
||||||
title="运送到"
|
title="运送到"
|
||||||
|
scopedSlots={{
|
||||||
|
default: (scope) => {
|
||||||
|
console.log("scope", scope);
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
class="cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
openPreview(
|
||||||
|
findLabelsByCode(
|
||||||
|
this.$api.mer_admin.getCityOptions(),
|
||||||
|
scope.row.cityCodes
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{findLabelsByCode(
|
||||||
|
this.$api.mer_admin.getCityOptions(),
|
||||||
|
scope.row.cityCodes
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}}
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
width="200px"
|
width="200px"
|
||||||
field="b"
|
field="first"
|
||||||
title="首件(个)"
|
title={groupMapper[row.groups].first}
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
width="200px"
|
width="200px"
|
||||||
field="c"
|
field="firstPrice"
|
||||||
title="首费(元)"
|
title="首费(元)"
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
width="200px"
|
width="200px"
|
||||||
field="d"
|
field="renewal"
|
||||||
title="续件(个)"
|
title={groupMapper[row.groups].renewal}
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
<vxe-column
|
<vxe-column
|
||||||
width="200px"
|
width="200px"
|
||||||
field="e"
|
field="renewalPrice"
|
||||||
title="运费(元)"
|
title="运费(元)"
|
||||||
></vxe-column>
|
></vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
|
|
|
@ -30,13 +30,13 @@ const BASE_DATA = {
|
||||||
//默认运费,不限制城市
|
//默认运费,不限制城市
|
||||||
cityCodes: "0",
|
cityCodes: "0",
|
||||||
//首重
|
//首重
|
||||||
first: "",
|
first: 1,
|
||||||
//首重价格
|
//首重价格
|
||||||
firstPrice: "",
|
firstPrice: 0,
|
||||||
//续重
|
//续重
|
||||||
renewal: "",
|
renewal: 1,
|
||||||
//续重价格
|
//续重价格
|
||||||
renewalPrice: "",
|
renewalPrice: 0,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
//追加
|
//追加
|
||||||
|
@ -121,8 +121,8 @@ export default {
|
||||||
|
|
||||||
//默认运费回显
|
//默认运费回显
|
||||||
_data.shippingTemplatesRegionList =
|
_data.shippingTemplatesRegionList =
|
||||||
[_data.shippingTemplatesRegionResultList?.[0]] ||
|
_data.shippingTemplatesRegionResultList?.slice(0,1)||
|
||||||
BASE_DATA.shippingTemplatesRegionList;
|
cloneDeep(BASE_DATA.shippingTemplatesRegionList);
|
||||||
//指定城市设置运费
|
//指定城市设置运费
|
||||||
_data.shippingTemplatesRegionListAppend =
|
_data.shippingTemplatesRegionListAppend =
|
||||||
_data.shippingTemplatesRegionResultList
|
_data.shippingTemplatesRegionResultList
|
||||||
|
@ -130,7 +130,7 @@ export default {
|
||||||
?.map((item) => {
|
?.map((item) => {
|
||||||
item.cityCodes = item.cityCodes.split(",");
|
item.cityCodes = item.cityCodes.split(",");
|
||||||
return item;
|
return item;
|
||||||
}) || BASE_DATA.shippingTemplatesRegionListAppend;
|
}) || cloneDeep(BASE_DATA.shippingTemplatesRegionListAppend);
|
||||||
//指定包邮条件
|
//指定包邮条件
|
||||||
_data.shippingTemplatesConditionList =
|
_data.shippingTemplatesConditionList =
|
||||||
_data.shippingTemplatesConditionResultList?.map((item) => {
|
_data.shippingTemplatesConditionResultList?.map((item) => {
|
||||||
|
@ -144,7 +144,7 @@ export default {
|
||||||
item.conditionType = "件数";
|
item.conditionType = "件数";
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}) || BASE_DATA.shippingTemplatesConditionList;
|
}) || cloneDeep(BASE_DATA.shippingTemplatesConditionList);
|
||||||
|
|
||||||
//计价方式
|
//计价方式
|
||||||
_data.calculateMethod = {
|
_data.calculateMethod = {
|
||||||
|
@ -167,7 +167,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
add: () => {
|
add: () => {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.modalData = JSON.parse(JSON.stringify(BASE_DATA));
|
this.modalData = cloneDeep(BASE_DATA);
|
||||||
});
|
});
|
||||||
this.isAdd = true;
|
this.isAdd = true;
|
||||||
this.modalConfig.title = "添加运费模板";
|
this.modalConfig.title = "添加运费模板";
|
||||||
|
@ -181,6 +181,8 @@ export default {
|
||||||
this.isAdd = true;
|
this.isAdd = true;
|
||||||
refillData(e);
|
refillData(e);
|
||||||
this.modalConfig.title = "添加运费模板";
|
this.modalConfig.title = "添加运费模板";
|
||||||
|
console.log("this.modalData",this.modalData);
|
||||||
|
|
||||||
this.modalData.templateName += "(复制)";
|
this.modalData.templateName += "(复制)";
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -394,6 +396,7 @@ export default {
|
||||||
//默认运费,不限制城市
|
//默认运费,不限制城市
|
||||||
cityCodes: "",
|
cityCodes: "",
|
||||||
//城市可选的选项
|
//城市可选的选项
|
||||||
|
cityOptions: [],
|
||||||
//首重
|
//首重
|
||||||
first: "",
|
first: "",
|
||||||
//首重价格
|
//首重价格
|
||||||
|
@ -522,9 +525,9 @@ export default {
|
||||||
>
|
>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
min={0}
|
min={0}
|
||||||
max={
|
max={Number(
|
||||||
Number(this.modalData.shippingTemplatesRegionList[0].firstPrice)
|
this.modalData.shippingTemplatesRegionList[0].firstPrice
|
||||||
}
|
)}
|
||||||
controls={false}
|
controls={false}
|
||||||
precision={2}
|
precision={2}
|
||||||
v-model={
|
v-model={
|
||||||
|
@ -544,7 +547,7 @@ export default {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
gt: 5,
|
gt: 5,
|
||||||
},
|
},
|
||||||
'show-overflow':true
|
"show-overflow": true,
|
||||||
}}
|
}}
|
||||||
style="height:50vh;"
|
style="height:50vh;"
|
||||||
enable-auto-query={false}
|
enable-auto-query={false}
|
||||||
|
@ -782,7 +785,7 @@ export default {
|
||||||
}[this.modalData.fareConfig],
|
}[this.modalData.fareConfig],
|
||||||
shippingTemplatesRegionList:
|
shippingTemplatesRegionList:
|
||||||
this.modalData.fareConfig == "全国包邮"
|
this.modalData.fareConfig == "全国包邮"
|
||||||
? null
|
? nu
|
||||||
: [
|
: [
|
||||||
...this.modalData.shippingTemplatesRegionList,
|
...this.modalData.shippingTemplatesRegionList,
|
||||||
...JSON.parse(
|
...JSON.parse(
|
||||||
|
|
Loading…
Reference in New Issue