From af2fb4bf5f287a406700ba3a3e083c3d5755d2c1 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Mon, 22 May 2023 23:10:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=B4=B9=E6=A8=A1=E6=9D=BF=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96=E3=80=82=E5=8C=BA=E5=9F=9F=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=BD=BF=E7=94=A8=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/area/index.ts | 12 +- src/utils/index.ts | 14 ++ src/utils/tree.ts | 3 +- .../DeliveryExpressTemplateForm.vue | 171 ++++++++++++++---- src/views/system/area/index.vue | 3 +- 5 files changed, 158 insertions(+), 45 deletions(-) diff --git a/src/api/system/area/index.ts b/src/api/system/area/index.ts index b43d47c0..69dd519b 100644 --- a/src/api/system/area/index.ts +++ b/src/api/system/area/index.ts @@ -1,8 +1,16 @@ import request from '@/config/axios' // 获得地区树 -export const getAreaTree = async (id: number) => { - return await request.get({ url: '/system/area/tree?id=' + id }) +export const getAreaTree = async () => { + return await request.get({ url: '/system/area/tree' }) +} + +export const getChildrenArea = async (id: number) => { + return await request.get({ url: '/system/area/getChildrenArea?id=' + id }) +} + +export const getAreaListByIds = async (data) => { + return await request.post({ url: '/system/area/list', data }) } // 获得 IP 对应的地区名 diff --git a/src/utils/index.ts b/src/utils/index.ts index 134bdf40..cf8ba38e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -194,3 +194,17 @@ export const convertToInteger = (num: number | string | undefined): number => { // TODO 分转元后还有小数则四舍五入 return Math.round(parsedNumber * 100) } + +/** + * 元转分 + */ +export const yuanToFen = (amount: string | number): number => { + return Math.round(Number(amount) * 100) +} + +/** + * 分转元 + */ +export const fenToYuan = (amount: string | number): number => { + return Number((Number(amount) / 100).toFixed(2)) +} diff --git a/src/utils/tree.ts b/src/utils/tree.ts index 51a64bd1..445adf1b 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -11,7 +11,8 @@ const DEFAULT_CONFIG: TreeHelperConfig = { export const defaultProps = { children: 'children', label: 'name', - value: 'id' + value: 'id', + isLeaf: 'leaf' } const getConfig = (config: Partial) => Object.assign({}, DEFAULT_CONFIG, config) diff --git a/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue b/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue index e3e175ed..024b8a88 100644 --- a/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue +++ b/src/views/mall/trade/delivery/expressTemplate/DeliveryExpressTemplateForm.vue @@ -21,16 +21,18 @@ @@ -39,7 +41,6 @@ -