Commit 14d40114 by linjinhong

修改发货地址中国家代码和国家名称选择项,添加PODUS待发货状态下更改物流功能

parent b309505b
......@@ -193,6 +193,12 @@ export function deleteAddressByIds(params: { ids: string }) {
},
)
}
//获取国家名称及代码
export function getAllCountryApi() {
return axios.get<never, BaseRespData<never>>(
'/logisticsAddress/getAllCountry',
)
}
/**
* @description 物流报价
......
......@@ -273,9 +273,9 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
}
// 更改物流
export function changeLogisticsApi(params: {
UpdateByIdParam: {
updateByIdParam: {
id: string | number
dataVersion: string
dataVersion: number
}
logisticsTrialCalculation: LogisticsData
}) {
......
......@@ -58,6 +58,7 @@ export interface PodUsOrderListData {
productList?: ProductList[]
orderNumber?: string
logisticsWayId?: number | null
logisticsWayName?: string
}
export interface ProductList {
id: number
......
......@@ -43,36 +43,11 @@
</el-tag>
</div>
<p
:title="
[
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
"
style="white-space: pre"
:title="getJosn(item)"
class="address"
>
{{
[
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
}}
{{ getJosn(item) }}
</p>
<p
:title="
......@@ -187,6 +162,7 @@ import {
updateAddress,
getLogisticsLog,
deleteAddressByIds,
getAllCountryApi,
} from '@/api/logistics'
import { IFormConfig } from '@/components/CustomizeForm.tsx'
......@@ -196,7 +172,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx'
import { Edit, Delete, List } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es'
import { ShippingAddressObj } from './types/shippingAddress.ts'
import { ShippingAddressObj, ICountryObj } from './types/shippingAddress.ts'
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from './hooks/useValue'
import { showConfirm } from '@/utils/ui'
......@@ -226,8 +202,9 @@ const {
const dialogVisible = ref(false)
const logDialogVisible = ref(false)
const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null)
const countryList = ref([])
const formConfig = ref<IFormConfig[]>([
const formConfig = computed<IFormConfig[]>(() => [
{
prop: 'shipperName',
type: 'input',
......@@ -266,88 +243,101 @@ const formConfig = ref<IFormConfig[]>([
},
},
{
prop: 'city',
type: 'input',
label: '城市',
prop: 'countryCode',
type: 'select',
label: '国家代码',
attrs: {
// options: [],
placeholder: '请输入城市',
options: countryList.value,
label: 'countryCode',
value: 'countryCode',
placeholder: '请选择国家代码',
onChange: (val: ICountryObj) => {
editForm.value.countryName = val.nameCn
},
rules: [{ required: true, message: '请输入城市' }],
},
rules: [{ required: true, message: '请选择国家代码' }],
},
{
prop: 'cityCode',
type: 'input',
label: '城市编码',
prop: 'countryName',
type: 'select',
label: '国家名称',
attrs: {
// options: [],
placeholder: '请输入城市编码',
options: countryList.value,
label: 'nameCn',
value: 'nameCn',
placeholder: '请选择国家名称',
onChange: (val: ICountryObj) => {
editForm.value.countryCode = val.countryCode
},
},
rules: [{ required: true, message: '请选择国家名称' }],
},
{
prop: 'district',
prop: 'stateProvince',
type: 'input',
label: '',
label: '州/省',
attrs: {
// options: [],
placeholder: '请选择区',
placeholder: '请输入州/省',
},
},
{
prop: 'districtCode',
prop: 'stateProvinceAbbr',
type: 'input',
label: '区编码',
label: '州/省简称',
attrs: {
// options: [],
placeholder: '请选择区',
placeholder: '请输入州/省简称',
},
},
{
prop: 'postalCode',
prop: 'cityCode',
type: 'input',
label: '邮编',
label: '城市编码',
attrs: {
placeholder: '请输入邮编',
// options: [],
placeholder: '请输入城市编码',
},
},
{
prop: 'stateProvince',
prop: 'city',
type: 'input',
label: '州/省',
label: '城市',
attrs: {
// options: [],
placeholder: '请输入州/省',
placeholder: '请输入城市',
},
rules: [{ required: true, message: '请输入城市' }],
},
{
prop: 'stateProvinceAbbr',
prop: 'districtCode',
type: 'input',
label: '州/省简称',
label: '区编码',
attrs: {
// options: [],
placeholder: '请输入州/省简称',
placeholder: '请选择区',
},
},
{
prop: 'countryName',
prop: 'district',
type: 'input',
label: '国家名称',
label: '',
attrs: {
// options: [],
placeholder: '请输入国家名称',
placeholder: '请选择区',
},
rules: [{ required: true, message: '请输入国家名称' }],
},
{
prop: 'countryCode',
prop: 'postalCode',
type: 'input',
label: '国家代码',
label: '邮编',
attrs: {
// options: [],
placeholder: '请输入国家代码',
placeholder: '请输入邮编',
},
rules: [{ required: true, message: '请输入邮编' }],
},
{
prop: 'phoneNumber',
......@@ -365,7 +355,36 @@ const formConfig = ref<IFormConfig[]>([
},
])
// const loading = ref(false)
async function getCountryList() {
try {
const { data } = await getAllCountryApi()
countryList.value = data
console.log(372, countryList.value)
} catch (error) {
console.log(error)
}
}
function getJosn(item: ShippingAddressObj) {
return [
[item.countryName, item.countryCode],
[item.stateProvince, item.stateProvinceAbbr],
[item.district, item.districtCode],
[item.city, item.cityCode],
]
.map(([value, code]) => {
if (value && code) return `${value} (${code})`
if (value) return value
if (code) return code // 当 value 不存在但 code 存在时,不使用括号
return null
})
.filter(Boolean)
.join(` `) // 使用三个空格作为分隔符增大间距
}
onMounted(() => {
getCountryList()
})
/**
* @description: 取消按钮
......
......@@ -22,3 +22,13 @@ export interface ShippingAddressObj {
updateTime?: string
checked?: boolean
}
export interface ICountryObj {
aeCountryCode: string
continentCode: string
countryCode: string
id: number
nameCn: string
nameEn: string
needProviceAbbr: number
}
......@@ -901,9 +901,11 @@
<el-dialog
v-model="isChangeWay"
:close-on-click-modal="false"
title="更换物流"
:title="`切换物流(当前物流方式:${selection[0]?.logisticsWayName})`"
>
<el-table
v-loading="isChangeWayLoading"
ref="changeWayRef"
height="400px"
class="production-client-table"
:data="logisticsWayData"
......@@ -947,8 +949,16 @@
</el-table-column>
</el-table>
<template #footer>
<el-button @click="isChangeWay = false">取消</el-button>
<el-button type="primary" @click="changeWaySubmit">确定</el-button>
<el-button :disabled="isChangeWayLoading" @click="isChangeWay = false">
取消
</el-button>
<el-button
:loading="isChangeWayLoading"
type="primary"
@click="changeWaySubmit"
>
确定
</el-button>
</template>
</el-dialog>
</template>
......@@ -981,8 +991,9 @@ import {
getTrackingNumberApi,
getfaceSimplexFileApi,
cancelLogisticsOrderApi,
// changeLogisticsApi,
changeLogisticsApi,
} from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue'
import {
LogListData,
......@@ -1707,11 +1718,26 @@ const getOrderByIdApi = async (type: string) => {
return
}
}
//展示返回结果
const resultInfo = ref([])
const resultConfim = () => {
search()
}
/**
* @description: 更改物流方式
*/
const changeWayRow = ref<LogisticsData>({} as LogisticsData)
const isChangeWayLoading = ref(false)
const changeWayRef = ref()
const currentChangeWay = (row: LogisticsData) => {
if (row.logisticsWayId == selection.value[0]?.logisticsWayId) {
changeWayRow.value = {} as LogisticsData
return changeWayRef.value?.setCurrentRow()
}
changeWayRow.value = row
}
const changeWaySubmit = () => {
const changeWaySubmit = async () => {
if (!changeWayRow.value?.logisticsWayId) {
return ElMessage.warning('请选择一条物流方式')
}
......@@ -1723,21 +1749,28 @@ const changeWaySubmit = () => {
if (!changeWayRow.value.status) {
return ElMessage.warning('请选择状态为成功的物流方式')
}
isChangeWayLoading.value = true
try {
const params = {
updateByIdParam: {
id: selection.value[0]?.id,
dataVersion: selection.value[0]?.version as number,
},
logisticsTrialCalculation: { ...changeWayRow.value },
}
// const params = {
// UpdateByIdParam: {
// id: selection.value[0]?.id,
// dataVersion: selection.value[0]?.version,
// },
// logisticsTrialCalculation: { ...changeWayRow.value },
// }
await changeLogisticsApi(params)
isChangeWay.value = false
// changeLogisticsApi(params)
}
const resultInfo = ref([])
const resultConfim = () => {
isChangeWayLoading.value = false
search()
loadTabData()
} catch (error) {
console.log(error)
} finally {
isChangeWayLoading.value = false
}
}
// 添加补货成功行的状态
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment