diff --git a/src/api/mall/trade/delivery/expressTemplate/index.ts b/src/api/mall/trade/delivery/expressTemplate/index.ts index 1a0f05c0..53f2cdeb 100644 --- a/src/api/mall/trade/delivery/expressTemplate/index.ts +++ b/src/api/mall/trade/delivery/expressTemplate/index.ts @@ -10,7 +10,7 @@ export interface DeliveryExpressTemplateVO { } export declare type ExpressTemplateChargeVO = { - areaId: number + areaIds: number[] startCount: number startPrice: number extraCount: number @@ -18,7 +18,7 @@ export declare type ExpressTemplateChargeVO = { } export declare type ExpressTemplateFreeVO = { - areaId: number + areaIds: number[] freeCount: number freePrice: number } diff --git a/src/api/mall/trade/delivery/pickUpStore/index.ts b/src/api/mall/trade/delivery/pickUpStore/index.ts new file mode 100644 index 00000000..90fb3d01 --- /dev/null +++ b/src/api/mall/trade/delivery/pickUpStore/index.ts @@ -0,0 +1,46 @@ +import request from '@/config/axios' + +export interface DeliveryPickUpStoreVO { + id: number + name: string + introduction: string + phone: string + areaId: number + detailAddress: string + logo: string + openingTime: string + closingTime: string + latitude: number + longitude: number + status: number +} + +// 查询自提门店列表 +export const getDeliveryPickUpStorePage = async (params: DeliveryPickUpStorePageReqVO) => { + return await request.get({ url: '/trade/delivery/pick-up-store/page', params }) +} + +// 查询自提门店详情 +export const getDeliveryPickUpStore = async (id: number) => { + return await request.get({ url: '/trade/delivery/pick-up-store/get?id=' + id }) +} + +// 新增自提门店 +export const createDeliveryPickUpStore = async (data: DeliveryPickUpStoreVO) => { + return await request.post({ url: '/trade/delivery/pick-up-store/create', data }) +} + +// 修改自提门店 +export const updateDeliveryPickUpStore = async (data: DeliveryPickUpStoreVO) => { + return await request.put({ url: '/trade/delivery/pick-up-store/update', data }) +} + +// 删除自提门店 +export const deleteDeliveryPickUpStore = async (id: number) => { + return await request.delete({ url: '/trade/delivery/pick-up-store/delete?id=' + id }) +} + +// 导出自提门店 Excel +export const exportDeliveryPickUpStoreApi = async (params) => { + return await request.download({ url: '/trade/delivery/pick-up-store/export-excel', params }) +} diff --git a/src/api/system/area/index.ts b/src/api/system/area/index.ts index 69dd519b..b7da941f 100644 --- a/src/api/system/area/index.ts +++ b/src/api/system/area/index.ts @@ -6,11 +6,11 @@ export const getAreaTree = async () => { } export const getChildrenArea = async (id: number) => { - return await request.get({ url: '/system/area/getChildrenArea?id=' + id }) + return await request.get({ url: '/system/area/get-children?id=' + id }) } -export const getAreaListByIds = async (data) => { - return await request.post({ url: '/system/area/list', data }) +export const getAreaListByIds = async (ids) => { + return await request.get({ url: '/system/area/get-by-ids?ids=' + ids }) } // 获得 IP 对应的地区名 diff --git a/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue b/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue similarity index 89% rename from src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue rename to src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue index aa52f83b..5b25422d 100644 --- a/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue +++ b/src/views/mall/trade/delivery/expressTemplate/ExpressTemplateForm.vue @@ -27,10 +27,11 @@ @@ -170,7 +172,6 @@ const formRules = reactive({ }) const formRef = ref() // 表单 Ref const areaCache = ref([]) //由于区域节点懒加载,已选区域节点需要缓存展示 -// let areaTree: any[] /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -183,25 +184,30 @@ const open = async (type: string, id?: number) => { formLoading.value = true formData.value = await DeliveryExpressTemplateApi.getDeliveryExpressTemplate(id) columnTitle.value = columnTitleMap.get(formData.value.chargeMode) - //已选的区域节点 - const areaIds = [] + const chargeAreaIds = [] + const freeAreaIds = [] formData.value.templateCharge.forEach((item) => { - //不等于全国的节点 - if (item.areaId !== 1) { - areaIds.push(item.areaId) + for (let i = 0; i < item.areaIds.length; i++) { + if (!chargeAreaIds.includes(item.areaIds[i])) { + chargeAreaIds.push(item.areaIds[i]) + } } //前端价格以元展示 item.startPrice = fenToYuan(item.startPrice) item.extraPrice = fenToYuan(item.extraPrice) }) formData.value.templateFree.forEach((item) => { - if (item.areaId !== 1 && !areaIds.includes(item.areaId)) { - areaIds.push(item.areaId) + for (let i = 0; i < item.areaIds.length; i++) { + if (!chargeAreaIds.includes(item.areaIds[i]) && !freeAreaIds.includes(item.areaIds[i])) { + freeAreaIds.push(item.areaIds[i]) + } } item.freePrice = fenToYuan(item.freePrice) }) + //已选的区域节点 + const areaIds = chargeAreaIds.concat(freeAreaIds) //区域节点,懒加载方式。 已选节点需要缓存展示 - areaCache.value = await getAreaListByIds(areaIds) + areaCache.value = await getAreaListByIds(areaIds.join(',')) } } finally { formLoading.value = false @@ -250,7 +256,7 @@ const resetForm = () => { chargeMode: 1, templateCharge: [ { - areaId: 1, + areaIds: [1], startCount: 2, startPrice: 5, extraCount: 5, @@ -300,10 +306,11 @@ const initData = async () => { /** 懒加载运费区域树 */ const loadChargeArea = async (node, resolve) => { + //已选区域需要禁止再次选择 const areaIds = [] formData.value.templateCharge.forEach((item) => { - if (item.areaId) { - areaIds.push(item.areaId) + if (item.areaIds.length > 0) { + item.areaIds.forEach((areaId) => areaIds.push(areaId)) } }) if (node.isLeaf) return resolve([]) @@ -312,7 +319,8 @@ const loadChargeArea = async (node, resolve) => { const data = cloneDeep(defaultArea) const item = data[0] if (areaIds.includes(item.id)) { - item.disabled = true + // TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅 + //item.disabled = true } resolve(data) } else { @@ -320,7 +328,7 @@ const loadChargeArea = async (node, resolve) => { const data = await getChildrenArea(id) data.forEach((item) => { if (areaIds.includes(item.id)) { - item.disabled = true + //item.disabled = true } }) resolve(data) @@ -330,11 +338,11 @@ const loadChargeArea = async (node, resolve) => { /** 懒加载包邮区域树 */ const loadFreeArea = async (node, resolve) => { if (node.isLeaf) return resolve([]) - //已经选择的区域id + //已选区域需要禁止再次选择 const areaIds = [] formData.value.templateFree.forEach((item) => { - if (item.areaId) { - areaIds.push(item.areaId) + if (item.areaIds.length > 0) { + item.areaIds.forEach((areaId) => areaIds.push(areaId)) } }) const length = node.data.length @@ -343,7 +351,7 @@ const loadFreeArea = async (node, resolve) => { const data = cloneDeep(defaultArea) const item = data[0] if (areaIds.includes(item.id)) { - item.disabled = true + //item.disabled = true } resolve(data) } else { @@ -352,7 +360,8 @@ const loadFreeArea = async (node, resolve) => { //已选区域需要禁止再次选择 data.forEach((item) => { if (areaIds.includes(item.id)) { - item.disabled = true + // TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅 + //item.disabled = true } }) resolve(data) @@ -362,7 +371,7 @@ const loadFreeArea = async (node, resolve) => { const addChargeArea = () => { const data = formData.value data.templateCharge.push({ - areaId: undefined, + areaIds: [], startCount: 1, startPrice: 1, extraCount: 1, @@ -378,7 +387,7 @@ const deleteChargeArea = (index) => { const addFreeArea = () => { const data = formData.value data.templateFree.push({ - areaId: undefined, + areaIds: [], freeCount: 1, freePrice: 1 }) diff --git a/src/views/mall/trade/delivery/expressTemplate/index.vue b/src/views/mall/trade/delivery/expressTemplate/index.vue index 99f90ada..e9f670f5 100644 --- a/src/views/mall/trade/delivery/expressTemplate/index.vue +++ b/src/views/mall/trade/delivery/expressTemplate/index.vue @@ -90,13 +90,13 @@ - + + diff --git a/src/views/mall/trade/delivery/pickUpStore/index.vue b/src/views/mall/trade/delivery/pickUpStore/index.vue new file mode 100644 index 00000000..d163af10 --- /dev/null +++ b/src/views/mall/trade/delivery/pickUpStore/index.vue @@ -0,0 +1,199 @@ + +