diff --git a/src/api/modules/mer_admin.js b/src/api/modules/mer_admin.js
index fb683b7..57c12e7 100644
--- a/src/api/modules/mer_admin.js
+++ b/src/api/modules/mer_admin.js
@@ -102,7 +102,7 @@ export const mer_admin = {
getShippingTemplateInfo: (id) => {
return $http.request({
method: 'get',
- url: '/merchant-api/shippingTemplates/list',
+ url: '/merchant-api/shippingTemplates/detail',
params: { id }
})
}
diff --git a/src/views/modules/logistics-fare/logistics-template/index.vue b/src/views/modules/logistics-fare/logistics-template/index.vue
index 2c70bd5..4c5ee4e 100644
--- a/src/views/modules/logistics-fare/logistics-template/index.vue
+++ b/src/views/modules/logistics-fare/logistics-template/index.vue
@@ -11,9 +11,12 @@
-
+
- 搜索
+ 搜索
添加运费模板 {
- this.$refs.oTable.complete([
- {
- 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,
- },
- ],
- },
- {
- templateName: "运费模板名称(全国包邮)",
- lastEditTime: "2022-02-15 12:02",
- tableData: [
- {
- a: "中国",
- b: 1,
- c: 0.0,
- d: 1,
- e: 0.0,
- },
- ],
- },
-
- ]);
- }, 1000);
+ this.$api.mer_admin
+ .getShippingTemplatePage({
+ pageNumber: pageNo,
+ pageSize: pageSize,
+ ...this.searchForm,
+ })
+ .then((res) => {
+ console.log(res);
+ this.$refs.oTable.complete(res.data.data.data,Number(res.data.data.total));
+ })
+ .catch(err=>{
+ this.$refs.oTable.complete(false);
+ })
},
addFareTemplate() {
this.$refs.addTemplate.toggle().add();
@@ -260,13 +66,22 @@ export default {
type: "jsx",
render: (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 (
-
{row.templateName}
+
{row.name}{appointMapper[row.appoint]}
-
最后编辑时间:{row.lastEditTime}
+
最后编辑时间:{row.updateTime}
复制模板
修改
diff --git a/src/views/modules/logistics-fare/logistics-template/popup/add-template.vue b/src/views/modules/logistics-fare/logistics-template/popup/add-template.vue
index 09966b0..7b5c80a 100644
--- a/src/views/modules/logistics-fare/logistics-template/popup/add-template.vue
+++ b/src/views/modules/logistics-fare/logistics-template/popup/add-template.vue
@@ -67,6 +67,43 @@ export default {
},
mounted() {},
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) {
if (this.modalConfig.show == false) {
this.modalConfig.show = true;
@@ -81,7 +118,7 @@ export default {
add: (item) => {
console.log(item);
this.$nextTick(() => {
- this.modalData = BASE_DATA;
+ this.modalData = JSON.parse(JSON.stringify(BASE_DATA));
});
this.isAdd = true;
},
@@ -101,6 +138,8 @@ export default {
prop: "templateName",
type: "Input",
maxlength: "30",
+ width: "300px",
+ clearable: true,
placeholder: "请输入模板名称",
rules: {
required: true,
@@ -145,6 +184,7 @@ export default {
);
},
},
+ //自定义运费
{
label: "自定义运费配置",
type: "jsx-out",
@@ -156,35 +196,58 @@ export default {
width: "300px",
field: "cityCodes",
type: "jsx",
- render: ({ row }) => {
+ render: ({ row, $rowIndex }) => {
const change = (e) => {
console.log(e);
+ console.log(
+ this.$refs.cityCode
+ .getCheckedNodes()
+ .filter((item) => !(item.parent && item.parent.checked))
+ );
};
return (
-
+ >
+
+
);
},
},
{
- title: "首重(kg)",
+ title:
+ this.modalData.calculateMethod == "按重量"
+ ? "首重(kg)"
+ : "首件(个)",
field: "first",
type: "jsx",
render: ({ row }) => {
@@ -193,7 +256,9 @@ export default {
style="width:100%;"
min={0}
controls={false}
- precision={2}
+ precision={
+ this.modalData.calculateMethod == "按重量" ? 2 : 0
+ }
v-model={row.first}
>
);
@@ -216,7 +281,10 @@ export default {
},
},
{
- title: "续重(kg)",
+ title:
+ this.modalData.calculateMethod == "按重量"
+ ? "续重(kg)"
+ : "续件数(个)",
field: "renewal",
type: "jsx",
render: ({ row }) => {
@@ -225,7 +293,9 @@ export default {
style="width:100%;"
min={0}
controls={false}
- precision={2}
+ precision={
+ this.modalData.calculateMethod == "按重量" ? 2 : 0
+ }
v-model={row.renewal}
>
);
@@ -317,14 +387,23 @@ export default {
}}
label="默认运费"
>
-
+ min={0}
+ controls={false}
+ precision={
+ this.modalData.calculateMethod == "按重量" ? 2 : 0
+ }
+ >
- kg内
+
+ {this.modalData.calculateMethod == "按重量"
+ ? "kg内"
+ : "件内"}
+
-
+ min={0}
+ controls={false}
+ precision={2}
+ >
元,每增加
@@ -355,14 +437,21 @@ export default {
}}
label=""
>
-
+ min={0}
+ controls={false}
+ precision={
+ this.modalData.calculateMethod == "按重量" ? 2 : 0
+ }
+ >
- kg,增加运费
+
+ {this.modalData.calculateMethod == "按重量" ? "kg" : "件"}
+ ,增加运费
-
+ >
元
@@ -437,7 +529,7 @@ export default {
props: {
multiple: true,
checkStrictly: false,
- emitPath: true,
+ emitPath: false,
label: "name",
value: "code",
},
@@ -502,7 +594,7 @@ export default {
return (
@@ -602,7 +694,56 @@ export default {
type: "primary",
loading: this.isLoading,
submit: true,
- handle: debounce(() => {}, 300),
+ handle: debounce(() => {
+ 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),
},
];
},