code review:门店自提、快递运费

pull/159/MERGE
YunaiV 2023-06-03 19:52:14 +08:00
parent 000aa95012
commit 60c1604d49
5 changed files with 51 additions and 25 deletions

View File

@ -47,8 +47,3 @@ export const updateDeliveryExpressTemplate = async (data: DeliveryExpressTemplat
export const deleteDeliveryExpressTemplate = async (id: number) => {
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 })
}

View File

@ -89,7 +89,7 @@
<el-table border style="width: 100%" :data="formData.templateFree">
<el-table-column align="center" label="区域">
<template #default="{ row }">
<!-- 区域数据太多用赖加载方式要不然性能有问题 -->
<!-- 区域数据太多用赖加载方式要不然性能有问题 -->
<el-tree-select
v-model="row.areaIds"
multiple
@ -171,7 +171,10 @@ const formRules = reactive({
sort: [{ required: true, message: '分类排序不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
const areaCache = ref([]) //
const areaCache = ref([]) //
// TODO @jason
// TODO @jaosn
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
@ -204,9 +207,9 @@ const open = async (type: string, id?: number) => {
}
item.freePrice = fenToYuan(item.freePrice)
})
//
//
const areaIds = chargeAreaIds.concat(freeAreaIds)
//
//
areaCache.value = await getAreaListByIds(areaIds.join(','))
}
} finally {
@ -226,8 +229,9 @@ const submitForm = async () => {
formLoading.value = true
try {
const data = formData.value as DeliveryExpressTemplateApi.DeliveryExpressTemplateVO
//
// TODO @jason
data.templateCharge.forEach((item) => {
//
item.startPrice = yuanToFen(item.startPrice)
item.extraPrice = yuanToFen(item.extraPrice)
})
@ -248,6 +252,7 @@ const submitForm = async () => {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
@ -269,6 +274,7 @@ const resetForm = () => {
columnTitle.value = columnTitleMap.get(1)
formRef.value?.resetFields()
}
/** 配送计费方法改变 */
const changeChargeMode = (chargeMode: number) => {
columnTitle.value = columnTitleMap.get(chargeMode)
@ -276,6 +282,24 @@ const changeChargeMode = (chargeMode: number) => {
const defaultArea = [{ id: 1, name: '全国', disabled: false }]
/** 初始化数据 */
// TODO @jasoncolumnTitleMap
// const columnTitleMap = {
// '1': {
// startCountTitle: '',
// extraCountTitle: '',
// freeCountTitle: ''
// },
// '2': {
// startCountTitle: '(kg)',
// extraCountTitle: '(kg)',
// freeCountTitle: '(kg)'
// },
// '3': {
// startCountTitle: '(m³)',
// extraCountTitle: '(m³)',
// freeCountTitle: '(m³)'
// }
// }
const initData = async () => {
// TODO
// formLoading.value = true
@ -286,7 +310,7 @@ const initData = async () => {
// } finally {
// formLoading.value = false
// }
//
//
columnTitleMap.set(1, {
startCountTitle: '首件',
extraCountTitle: '续件',
@ -320,6 +344,7 @@ const loadChargeArea = async (node, resolve) => {
const item = data[0]
if (areaIds.includes(item.id)) {
// TODO @
// TODO @jason
//item.disabled = true
}
resolve(data)
@ -357,10 +382,11 @@ const loadFreeArea = async (node, resolve) => {
} else {
const id = node.data.id
const data = await getChildrenArea(id)
//
//
data.forEach((item) => {
if (areaIds.includes(item.id)) {
// TODO @
// TODO @jason
//item.disabled = true
}
})
@ -378,11 +404,13 @@ const addChargeArea = () => {
extraPrice: 1
})
}
/** 删除计费区域 */
const deleteChargeArea = (index) => {
const data = formData.value
data.templateCharge.splice(index, 1)
}
/** 添加包邮区域 */
const addFreeArea = () => {
const data = formData.value
@ -392,6 +420,7 @@ const addFreeArea = () => {
freePrice: 1
})
}
/** 删除包邮区域 */
const deleteFreeArea = (index) => {
const data = formData.value

View File

@ -110,6 +110,7 @@ const queryParams = reactive({
chargeMode: undefined
})
const queryFormRef = ref() //
/** 查询列表 */
const getList = async () => {
loading.value = true

View File

@ -51,7 +51,7 @@
<el-row>
<el-col :span="12">
<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-col>
<el-col :span="12">
@ -99,7 +99,7 @@
</el-col>
</el-row>
<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>
<template #footer>
@ -125,6 +125,7 @@ import { getAreaTree } from '@/api/system/area'
import * as ConfigApi from '@/api/infra/config'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const mapDialogVisible = ref(false) //
const dialogTitle = ref('') //
@ -160,14 +161,15 @@ const formRules = reactive({
status: [{ required: true, message: '开启状态不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
const cascaderProps = {
const areaTreeProps = {
children: 'children',
label: 'name',
value: 'id',
emitPath: false
}
const areaList = ref() //
const tencentLbsUrl = ref('') // url
const tencentLbsUrl = ref('') // url
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
@ -196,7 +198,6 @@ const submitForm = async () => {
//
formLoading.value = true
try {
console.log('formData.value', formData.value)
const data = formData.value as DeliveryPickUpStoreApi.DeliveryPickUpStoreVO
if (formType.value === 'create') {
await DeliveryPickUpStoreApi.createDeliveryPickUpStore(data)
@ -222,7 +223,7 @@ const resetForm = () => {
logo: '',
detailAddress: '',
introduction: '',
areaId: 1,
areaId: undefined,
openingTime: undefined,
closingTime: undefined,
latitude: undefined,
@ -232,11 +233,7 @@ const resetForm = () => {
formRef.value?.resetFields()
}
//
const searchLocation = async () => {
mapDialogVisible.value = true
}
//
/** 选择经纬度 */
const selectAddress = function (loc: any): void {
if (loc.latlng && loc.latlng.lat) {
formData.value.latitude = loc.latlng.lat
@ -246,6 +243,7 @@ const selectAddress = function (loc: any): void {
}
mapDialogVisible.value = false
}
/** 初始化数据 */
const initData = async () => {
formLoading.value = true
@ -255,6 +253,7 @@ const initData = async () => {
} finally {
formLoading.value = false
}
// TODO @jason initTencentLbsMap
window.selectAddress = selectAddress
window.addEventListener(
'message',
@ -262,7 +261,7 @@ const initData = async () => {
//
let loc = event.data
if (loc && loc.module === 'locationPicker') {
// postmodule'locationPicker'
// post module 'locationPicker'
window.parent.selectAddress(loc)
}
},

View File

@ -121,6 +121,7 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
const message = useMessage() //
const { t } = useI18n() //
const total = ref(0) //
const loading = ref(true) //
const exportLoading = ref(false) //
@ -134,6 +135,7 @@ const queryParams = reactive({
createTime: []
})
const queryFormRef = ref() //
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
@ -153,7 +155,7 @@ const handleDelete = async (id: number) => {
} catch {}
}
//** */
/** 查询列表 */
const getList = async () => {
loading.value = true
try {