parent
a29421dd41
commit
16c518e18a
@ -52,8 +52,3 @@ export const updateDeliveryExpressTemplate = async (data: DeliveryExpressTemplat
|
|||||||
export const deleteDeliveryExpressTemplate = async (id: number) => {
|
export const deleteDeliveryExpressTemplate = async (id: number) => {
|
||||||
return await request.delete({ url: '/trade/delivery/express-template/delete?id=' + id })
|
return await request.delete({ url: '/trade/delivery/express-template/delete?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出快递运费模板 Excel
|
|
||||||
export const exportDeliveryExpressTemplateApi = async (params) => {
|
|
||||||
return await request.download({ url: '/trade/delivery/express-template/export-excel', params })
|
|
||||||
}
|
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
<el-table border style="width: 100%" :data="formData.templateFree">
|
<el-table border style="width: 100%" :data="formData.templateFree">
|
||||||
<el-table-column align="center" label="区域">
|
<el-table-column align="center" label="区域">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<!-- 区域数据太多,用赖加载方式,要不然性能有问题 -->
|
<!-- 区域数据太多,用赖加载方式,要不然性能有问题 -->
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="row.areaIds"
|
v-model="row.areaIds"
|
||||||
multiple
|
multiple
|
||||||
@ -171,7 +171,10 @@ const formRules = reactive({
|
|||||||
sort: [{ required: true, message: '分类排序不能为空', trigger: 'blur' }]
|
sort: [{ required: true, message: '分类排序不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const areaCache = ref([]) //由于区域节点懒加载,已选区域节点需要缓存展示
|
const areaCache = ref([]) // 由于区域节点懒加载,已选区域节点需要缓存展示
|
||||||
|
// TODO @jason:配送的时候,只允许选择省市级别,不允许选择区;如果这样的话,是不是打开弹窗,直接把城市都请求过来;
|
||||||
|
// TODO @jaosn:因为只有省市两级,感觉就不用特殊做全国逻辑;选择全国,就默认把子节点都选择上;另外,选择父节点,要把子节点选中哈;
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
@ -204,9 +207,9 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
item.freePrice = fenToYuan(item.freePrice)
|
item.freePrice = fenToYuan(item.freePrice)
|
||||||
})
|
})
|
||||||
//已选的区域节点
|
// 已选的区域节点
|
||||||
const areaIds = chargeAreaIds.concat(freeAreaIds)
|
const areaIds = chargeAreaIds.concat(freeAreaIds)
|
||||||
//区域节点,懒加载方式。 已选节点需要缓存展示
|
// 区域节点,懒加载方式。已选节点需要缓存展示
|
||||||
areaCache.value = await getAreaListByIds(areaIds.join(','))
|
areaCache.value = await getAreaListByIds(areaIds.join(','))
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -226,8 +229,9 @@ const submitForm = async () => {
|
|||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = formData.value as DeliveryExpressTemplateApi.DeliveryExpressTemplateVO
|
const data = formData.value as DeliveryExpressTemplateApi.DeliveryExpressTemplateVO
|
||||||
|
// 前端价格以元展示,提交到后端。用分计算
|
||||||
|
// TODO @jason:不能直接这样改,要复制出来改。不然后端操作失败,数据已经被改了
|
||||||
data.templateCharge.forEach((item) => {
|
data.templateCharge.forEach((item) => {
|
||||||
//前端价格以元展示,提交到后端。用分计算
|
|
||||||
item.startPrice = yuanToFen(item.startPrice)
|
item.startPrice = yuanToFen(item.startPrice)
|
||||||
item.extraPrice = yuanToFen(item.extraPrice)
|
item.extraPrice = yuanToFen(item.extraPrice)
|
||||||
})
|
})
|
||||||
@ -248,6 +252,7 @@ const submitForm = async () => {
|
|||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
@ -269,6 +274,7 @@ const resetForm = () => {
|
|||||||
columnTitle.value = columnTitleMap.get(1)
|
columnTitle.value = columnTitleMap.get(1)
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 配送计费方法改变 */
|
/** 配送计费方法改变 */
|
||||||
const changeChargeMode = (chargeMode: number) => {
|
const changeChargeMode = (chargeMode: number) => {
|
||||||
columnTitle.value = columnTitleMap.get(chargeMode)
|
columnTitle.value = columnTitleMap.get(chargeMode)
|
||||||
@ -276,6 +282,24 @@ const changeChargeMode = (chargeMode: number) => {
|
|||||||
const defaultArea = [{ id: 1, name: '全国', disabled: false }]
|
const defaultArea = [{ id: 1, name: '全国', disabled: false }]
|
||||||
|
|
||||||
/** 初始化数据 */
|
/** 初始化数据 */
|
||||||
|
// TODO @jason:是不是不用写这样一个初始化方法,columnTitleMap 直接就可以了呀
|
||||||
|
// const columnTitleMap = {
|
||||||
|
// '1': {
|
||||||
|
// startCountTitle: '首件',
|
||||||
|
// extraCountTitle: '续件',
|
||||||
|
// freeCountTitle: '包邮件数'
|
||||||
|
// },
|
||||||
|
// '2': {
|
||||||
|
// startCountTitle: '首件重量(kg)',
|
||||||
|
// extraCountTitle: '续件重量(kg)',
|
||||||
|
// freeCountTitle: '包邮重量(kg)'
|
||||||
|
// },
|
||||||
|
// '3': {
|
||||||
|
// startCountTitle: '首件体积(m³)',
|
||||||
|
// extraCountTitle: '续件体积(m³)',
|
||||||
|
// freeCountTitle: '包邮体积(m³)'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
// TODO 从服务端全量加载数据, 后面看懒加载是不是可以从前端获取数据。 目前从后端获取数据
|
// TODO 从服务端全量加载数据, 后面看懒加载是不是可以从前端获取数据。 目前从后端获取数据
|
||||||
// formLoading.value = true
|
// formLoading.value = true
|
||||||
@ -286,7 +310,7 @@ const initData = async () => {
|
|||||||
// } finally {
|
// } finally {
|
||||||
// formLoading.value = false
|
// formLoading.value = false
|
||||||
// }
|
// }
|
||||||
//表头标题和计费方式的映射
|
// 表头标题和计费方式的映射
|
||||||
columnTitleMap.set(1, {
|
columnTitleMap.set(1, {
|
||||||
startCountTitle: '首件',
|
startCountTitle: '首件',
|
||||||
extraCountTitle: '续件',
|
extraCountTitle: '续件',
|
||||||
@ -320,6 +344,7 @@ const loadChargeArea = async (node, resolve) => {
|
|||||||
const item = data[0]
|
const item = data[0]
|
||||||
if (areaIds.includes(item.id)) {
|
if (areaIds.includes(item.id)) {
|
||||||
// TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅
|
// TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅
|
||||||
|
// TODO @jason:先不做这个功能哈。
|
||||||
//item.disabled = true
|
//item.disabled = true
|
||||||
}
|
}
|
||||||
resolve(data)
|
resolve(data)
|
||||||
@ -357,10 +382,11 @@ const loadFreeArea = async (node, resolve) => {
|
|||||||
} else {
|
} else {
|
||||||
const id = node.data.id
|
const id = node.data.id
|
||||||
const data = await getChildrenArea(id)
|
const data = await getChildrenArea(id)
|
||||||
//已选区域需要禁止再次选择
|
// 已选区域需要禁止再次选择
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
if (areaIds.includes(item.id)) {
|
if (areaIds.includes(item.id)) {
|
||||||
// TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅
|
// TODO 禁止选中的区域有些问题, 导致修改时候不能重新选择 不知道如何处理。 暂时注释掉 @芋艿 有空瞅瞅
|
||||||
|
// TODO @jason:先不做这个功能哈。
|
||||||
//item.disabled = true
|
//item.disabled = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -378,11 +404,13 @@ const addChargeArea = () => {
|
|||||||
extraPrice: 1
|
extraPrice: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除计费区域 */
|
/** 删除计费区域 */
|
||||||
const deleteChargeArea = (index) => {
|
const deleteChargeArea = (index) => {
|
||||||
const data = formData.value
|
const data = formData.value
|
||||||
data.templateCharge.splice(index, 1)
|
data.templateCharge.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加包邮区域 */
|
/** 添加包邮区域 */
|
||||||
const addFreeArea = () => {
|
const addFreeArea = () => {
|
||||||
const data = formData.value
|
const data = formData.value
|
||||||
@ -392,6 +420,7 @@ const addFreeArea = () => {
|
|||||||
freePrice: 1
|
freePrice: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除包邮区域 */
|
/** 删除包邮区域 */
|
||||||
const deleteFreeArea = (index) => {
|
const deleteFreeArea = (index) => {
|
||||||
const data = formData.value
|
const data = formData.value
|
||||||
|
@ -110,6 +110,7 @@ const queryParams = reactive({
|
|||||||
chargeMode: undefined
|
chargeMode: undefined
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="门店所在地区" prop="areaId">
|
<el-form-item label="门店所在地区" prop="areaId">
|
||||||
<el-cascader v-model="formData.areaId" :options="areaList" :props="cascaderProps" />
|
<el-cascader v-model="formData.areaId" :options="areaList" :props="areaTreeProps" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -99,7 +99,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item label="获取经纬度">
|
<el-form-item label="获取经纬度">
|
||||||
<el-button type="primary" @click="searchLocation">获取</el-button>
|
<el-button type="primary" @click="mapDialogVisible.value = true">获取</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -125,6 +125,7 @@ import { getAreaTree } from '@/api/system/area'
|
|||||||
import * as ConfigApi from '@/api/infra/config'
|
import * as ConfigApi from '@/api/infra/config'
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const mapDialogVisible = ref(false) // 地图弹窗的是否展示
|
const mapDialogVisible = ref(false) // 地图弹窗的是否展示
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
@ -160,14 +161,15 @@ const formRules = reactive({
|
|||||||
status: [{ required: true, message: '开启状态不能为空', trigger: 'blur' }]
|
status: [{ required: true, message: '开启状态不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const cascaderProps = {
|
const areaTreeProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'id',
|
value: 'id',
|
||||||
emitPath: false
|
emitPath: false
|
||||||
}
|
}
|
||||||
const areaList = ref() // 区域树
|
const areaList = ref() // 区域树
|
||||||
const tencentLbsUrl = ref('') //腾讯位置服务 url
|
const tencentLbsUrl = ref('') // 腾讯位置服务 url
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
@ -196,7 +198,6 @@ const submitForm = async () => {
|
|||||||
// 提交请求
|
// 提交请求
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
console.log('formData.value', formData.value)
|
|
||||||
const data = formData.value as DeliveryPickUpStoreApi.DeliveryPickUpStoreVO
|
const data = formData.value as DeliveryPickUpStoreApi.DeliveryPickUpStoreVO
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await DeliveryPickUpStoreApi.createDeliveryPickUpStore(data)
|
await DeliveryPickUpStoreApi.createDeliveryPickUpStore(data)
|
||||||
@ -222,7 +223,7 @@ const resetForm = () => {
|
|||||||
logo: '',
|
logo: '',
|
||||||
detailAddress: '',
|
detailAddress: '',
|
||||||
introduction: '',
|
introduction: '',
|
||||||
areaId: 1,
|
areaId: undefined,
|
||||||
openingTime: undefined,
|
openingTime: undefined,
|
||||||
closingTime: undefined,
|
closingTime: undefined,
|
||||||
latitude: undefined,
|
latitude: undefined,
|
||||||
@ -232,11 +233,7 @@ const resetForm = () => {
|
|||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
//查找位置
|
/** 选择经纬度 */
|
||||||
const searchLocation = async () => {
|
|
||||||
mapDialogVisible.value = true
|
|
||||||
}
|
|
||||||
// 选择经纬度
|
|
||||||
const selectAddress = function (loc: any): void {
|
const selectAddress = function (loc: any): void {
|
||||||
if (loc.latlng && loc.latlng.lat) {
|
if (loc.latlng && loc.latlng.lat) {
|
||||||
formData.value.latitude = loc.latlng.lat
|
formData.value.latitude = loc.latlng.lat
|
||||||
@ -246,6 +243,7 @@ const selectAddress = function (loc: any): void {
|
|||||||
}
|
}
|
||||||
mapDialogVisible.value = false
|
mapDialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化数据 */
|
/** 初始化数据 */
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
@ -255,6 +253,7 @@ const initData = async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
|
// TODO @jason:要不创建一个 initTencentLbsMap
|
||||||
window.selectAddress = selectAddress
|
window.selectAddress = selectAddress
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
'message',
|
'message',
|
||||||
@ -262,7 +261,7 @@ const initData = async () => {
|
|||||||
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
|
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
|
||||||
let loc = event.data
|
let loc = event.data
|
||||||
if (loc && loc.module === 'locationPicker') {
|
if (loc && loc.module === 'locationPicker') {
|
||||||
// 防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
|
// 防止其他应用也会向该页面 post 信息,需判断 module 是否为 'locationPicker'
|
||||||
window.parent.selectAddress(loc)
|
window.parent.selectAddress(loc)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -121,6 +121,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
|||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
@ -134,6 +135,7 @@ const queryParams = reactive({
|
|||||||
createTime: []
|
createTime: []
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
/** 添加/修改操作 */
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
const openForm = (type: string, id?: number) => {
|
const openForm = (type: string, id?: number) => {
|
||||||
@ -153,7 +155,7 @@ const handleDelete = async (id: number) => {
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
//** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user