Commit 7539643f by linjinhong

Merge remote-tracking branch 'origin/linjinhong' into dev

parents 0fd5f886 63e91d11
...@@ -193,6 +193,12 @@ export function deleteAddressByIds(params: { ids: string }) { ...@@ -193,6 +193,12 @@ export function deleteAddressByIds(params: { ids: string }) {
}, },
) )
} }
//获取国家名称及代码
export function getAllCountryApi() {
return axios.get<never, BaseRespData<never>>(
'/logisticsAddress/getAllCountry',
)
}
/** /**
* @description 物流报价 * @description 物流报价
......
...@@ -273,9 +273,9 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) { ...@@ -273,9 +273,9 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
} }
// 更改物流 // 更改物流
export function changeLogisticsApi(params: { export function changeLogisticsApi(params: {
UpdateByIdParam: { updateByIdParam: {
id: string | number id: string | number
dataVersion: string dataVersion: number
} }
logisticsTrialCalculation: LogisticsData logisticsTrialCalculation: LogisticsData
}) { }) {
......
...@@ -58,6 +58,7 @@ export interface PodUsOrderListData { ...@@ -58,6 +58,7 @@ export interface PodUsOrderListData {
productList?: ProductList[] productList?: ProductList[]
orderNumber?: string orderNumber?: string
logisticsWayId?: number | null logisticsWayId?: number | null
logisticsWayName?: string
} }
export interface ProductList { export interface ProductList {
id: number id: number
......
...@@ -43,36 +43,11 @@ ...@@ -43,36 +43,11 @@
</el-tag> </el-tag>
</div> </div>
<p <p
:title=" style="white-space: pre"
[ :title="getJosn(item)"
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
"
class="address" class="address"
> >
{{ {{ getJosn(item) }}
[
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
}}
</p> </p>
<p <p
:title=" :title="
...@@ -187,6 +162,7 @@ import { ...@@ -187,6 +162,7 @@ import {
updateAddress, updateAddress,
getLogisticsLog, getLogisticsLog,
deleteAddressByIds, deleteAddressByIds,
getAllCountryApi,
} from '@/api/logistics' } from '@/api/logistics'
import { IFormConfig } from '@/components/CustomizeForm.tsx' import { IFormConfig } from '@/components/CustomizeForm.tsx'
...@@ -196,7 +172,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx' ...@@ -196,7 +172,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx'
import { Edit, Delete, List } from '@element-plus/icons-vue' import { Edit, Delete, List } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es' 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 usePageList from '@/utils/hooks/usePageList'
import { useValue } from './hooks/useValue' import { useValue } from './hooks/useValue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
...@@ -226,8 +202,9 @@ const { ...@@ -226,8 +202,9 @@ const {
const dialogVisible = ref(false) const dialogVisible = ref(false)
const logDialogVisible = ref(false) const logDialogVisible = ref(false)
const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null) const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null)
const countryList = ref([])
const formConfig = ref<IFormConfig[]>([ const formConfig = computed<IFormConfig[]>(() => [
{ {
prop: 'shipperName', prop: 'shipperName',
type: 'input', type: 'input',
...@@ -266,88 +243,101 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -266,88 +243,101 @@ const formConfig = ref<IFormConfig[]>([
}, },
}, },
{ {
prop: 'city', prop: 'countryCode',
type: 'input', type: 'select',
label: '城市', label: '国家代码',
attrs: { attrs: {
// options: [], options: countryList.value,
placeholder: '请输入城市', label: 'countryCode',
value: 'countryCode',
placeholder: '请选择国家代码',
onChange: (val: ICountryObj) => {
editForm.value.countryName = val.nameCn
}, },
rules: [{ required: true, message: '请输入城市' }], },
rules: [{ required: true, message: '请选择国家代码' }],
}, },
{ {
prop: 'cityCode', prop: 'countryName',
type: 'input', type: 'select',
label: '城市编码', label: '国家名称',
attrs: { attrs: {
// options: [], options: countryList.value,
placeholder: '请输入城市编码', label: 'nameCn',
value: 'nameCn',
placeholder: '请选择国家名称',
onChange: (val: ICountryObj) => {
editForm.value.countryCode = val.countryCode
},
}, },
rules: [{ required: true, message: '请选择国家名称' }],
}, },
{ {
prop: 'district', prop: 'stateProvince',
type: 'input', type: 'input',
label: '', label: '州/省',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请选择区', placeholder: '请输入州/省',
}, },
}, },
{ {
prop: 'districtCode', prop: 'stateProvinceAbbr',
type: 'input', type: 'input',
label: '区编码', label: '州/省简称',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请选择区', placeholder: '请输入州/省简称',
}, },
}, },
{ {
prop: 'postalCode', prop: 'cityCode',
type: 'input', type: 'input',
label: '邮编', label: '城市编码',
attrs: { attrs: {
placeholder: '请输入邮编', // options: [],
placeholder: '请输入城市编码',
}, },
}, },
{ {
prop: 'stateProvince', prop: 'city',
type: 'input', type: 'input',
label: '州/省', label: '城市',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入州/省', placeholder: '请输入城市',
}, },
rules: [{ required: true, message: '请输入城市' }],
}, },
{ {
prop: 'stateProvinceAbbr', prop: 'districtCode',
type: 'input', type: 'input',
label: '州/省简称', label: '区编码',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入州/省简称', placeholder: '请选择区',
}, },
}, },
{ {
prop: 'countryName', prop: 'district',
type: 'input', type: 'input',
label: '国家名称', label: '',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入国家名称', placeholder: '请选择区',
}, },
rules: [{ required: true, message: '请输入国家名称' }],
}, },
{ {
prop: 'countryCode', prop: 'postalCode',
type: 'input', type: 'input',
label: '国家代码', label: '邮编',
attrs: { attrs: {
// options: [], placeholder: '请输入邮编',
placeholder: '请输入国家代码',
}, },
rules: [{ required: true, message: '请输入邮编' }],
}, },
{ {
prop: 'phoneNumber', prop: 'phoneNumber',
...@@ -365,7 +355,36 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -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: 取消按钮 * @description: 取消按钮
......
...@@ -22,3 +22,13 @@ export interface ShippingAddressObj { ...@@ -22,3 +22,13 @@ export interface ShippingAddressObj {
updateTime?: string updateTime?: string
checked?: boolean checked?: boolean
} }
export interface ICountryObj {
aeCountryCode: string
continentCode: string
countryCode: string
id: number
nameCn: string
nameEn: string
needProviceAbbr: number
}
...@@ -901,9 +901,11 @@ ...@@ -901,9 +901,11 @@
<el-dialog <el-dialog
v-model="isChangeWay" v-model="isChangeWay"
:close-on-click-modal="false" :close-on-click-modal="false"
title="更换物流" :title="`切换物流(当前物流方式:${selection[0]?.logisticsWayName})`"
> >
<el-table <el-table
v-loading="isChangeWayLoading"
ref="changeWayRef"
height="400px" height="400px"
class="production-client-table" class="production-client-table"
:data="logisticsWayData" :data="logisticsWayData"
...@@ -947,8 +949,16 @@ ...@@ -947,8 +949,16 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<template #footer> <template #footer>
<el-button @click="isChangeWay = false">取消</el-button> <el-button :disabled="isChangeWayLoading" @click="isChangeWay = false">
<el-button type="primary" @click="changeWaySubmit">确定</el-button> 取消
</el-button>
<el-button
:loading="isChangeWayLoading"
type="primary"
@click="changeWaySubmit"
>
确定
</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
...@@ -981,8 +991,9 @@ import { ...@@ -981,8 +991,9 @@ import {
getTrackingNumberApi, getTrackingNumberApi,
getfaceSimplexFileApi, getfaceSimplexFileApi,
cancelLogisticsOrderApi, cancelLogisticsOrderApi,
// changeLogisticsApi, changeLogisticsApi,
} from '@/api/podUsOrder' } from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
LogListData, LogListData,
...@@ -1717,11 +1728,26 @@ const getOrderByIdApi = async (type: string) => { ...@@ -1717,11 +1728,26 @@ const getOrderByIdApi = async (type: string) => {
return return
} }
} }
//展示返回结果
const resultInfo = ref([])
const resultConfim = () => {
search()
}
/**
* @description: 更改物流方式
*/
const changeWayRow = ref<LogisticsData>({} as LogisticsData) const changeWayRow = ref<LogisticsData>({} as LogisticsData)
const isChangeWayLoading = ref(false)
const changeWayRef = ref()
const currentChangeWay = (row: LogisticsData) => { const currentChangeWay = (row: LogisticsData) => {
if (row.logisticsWayId == selection.value[0]?.logisticsWayId) {
changeWayRow.value = {} as LogisticsData
return changeWayRef.value?.setCurrentRow()
}
changeWayRow.value = row changeWayRow.value = row
} }
const changeWaySubmit = () => { const changeWaySubmit = async () => {
if (!changeWayRow.value?.logisticsWayId) { if (!changeWayRow.value?.logisticsWayId) {
return ElMessage.warning('请选择一条物流方式') return ElMessage.warning('请选择一条物流方式')
} }
...@@ -1733,21 +1759,28 @@ const changeWaySubmit = () => { ...@@ -1733,21 +1759,28 @@ const changeWaySubmit = () => {
if (!changeWayRow.value.status) { if (!changeWayRow.value.status) {
return ElMessage.warning('请选择状态为成功的物流方式') 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 = { await changeLogisticsApi(params)
// UpdateByIdParam: {
// id: selection.value[0]?.id,
// dataVersion: selection.value[0]?.version,
// },
// logisticsTrialCalculation: { ...changeWayRow.value },
// }
isChangeWay.value = false isChangeWay.value = false
// changeLogisticsApi(params)
} isChangeWayLoading.value = false
const resultInfo = ref([])
const resultConfim = () => {
search() 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