Commit e8cb1d1c by zhuzhequan

feat:刷新地址功能

parent 23e6429e
......@@ -556,6 +556,19 @@ export function changeToFinished(ids: string) {
)
}
export function reissueOrderApi(ids: string) {
return axios.get<never, BaseRespData<never>>(
`factory/podJomallOrderUs/reissueOrder`,
{ params: { ids } },
)
}
export function OrderCnReceiverAddress(idList: number[]) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/syncReceiverAddress`,
idList,
)
}
// 转至已完成
export function updateTrackingNumberAndRegister(
id: number,
......
......@@ -7,6 +7,7 @@
:stripe="stripe"
header-align="center"
height="100%"
@row-click="rowClick"
v-bind="attrs"
:class="internalIsMore ? 'is-more-active' : ''"
@header-click="handleTableHeaderClick"
......@@ -88,6 +89,11 @@ const props = defineProps({
type: Array,
required: true,
},
rowClickSelect: {
type: Boolean,
required: false,
default: false,
},
columns: {
type: Array as PropType<CustomColumn<T>>,
required: true,
......@@ -127,7 +133,13 @@ const clearSelection = () => {
const toggleAllSelection = () => {
tableRef.value?.toggleAllSelection()
}
const rowClick = (row:NonNullable<unknown>)=>{
console.log(row)
console.log(tableRef.value,props.rowClickSelect)
if(props.rowClickSelect){
tableRef.value?.toggleRowSelection(row,true)
}
}
const handleTableHeaderClick = (column: { type?: string }, event: Event) => {
if (column.type === 'selection' && props.isMore) {
event.preventDefault()
......
<script setup lang="ts">
import { OrderCnReceiverAddress } from '@/api/podUsOrder.ts'
defineOptions({
name: 'OrderTracking',
})
......@@ -39,7 +41,8 @@ import { filePath } from '@/api/axios'
import { convertToChinaTime } from '@/utils/index'
import { useValue } from '@/utils/hooks/useValue'
import { ElFormItem } from 'element-plus'
const tabValue = ref('1')
const [searchForm, resetSearchForm] = useValue<SearchForm>({
timeType: 1,
shopNumber: '',
......@@ -93,6 +96,12 @@ const tableColumns = computed(() => {
align: 'center',
},
{
label: '是否代发',
slot: 'replaceShipment',
prop: 'replaceShipment',
width: 120,
align: 'center',
},{
label: '物流类型',
slot: 'shipmentType',
prop: 'shipmentType',
......@@ -367,6 +376,10 @@ const search = () => {
goodsData.value = []
logList.value = []
getOrderListFn()
if(tabValue.value==='2'){
zoneType.value = 'Asia/Shanghai'
operationLog()
}
}
const getDateRange = (days = 0, type: 'past' | 'future' = 'past') => {
......@@ -551,6 +564,7 @@ const getOrderListFn = async () => {
}
}
const currentRowId = ref<number>()
function rowClick(row: PodCnOrderListData) {
currentRowId.value = row.id
goodsLoading.value = true
......@@ -560,6 +574,7 @@ function rowClick(row: PodCnOrderListData) {
clearTimeout(timer)
}, 500)
}
const logLoading = ref(false)
const operationLog = async () => {
logLoading.value = true
......@@ -614,10 +629,43 @@ const resultInfo = ref<
>([])
const resultRefs = ref<InstanceType<typeof ResultInfo> | null>(null)
const refreshAddress = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
await ElMessageBox.confirm('是否刷新地址?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await OrderCnReceiverAddress(
selection.value.map((item) => item.id),
)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
await loadTabData()
if(tabValue.value==='2'){
zoneType.value = 'Asia/Shanghai'
await operationLog()
}
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
/**
* @description: 获取打印面单
*/
const getOrderByIdApi = async (type: string) => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
......@@ -681,6 +729,7 @@ const getOrderByIdApi = async (type: string) => {
const tempChinaLogs = ref<LogListData[]>([])
const zoneType = ref<string>('Asia/Shanghai')
function changeChinaTime(zone: string) {
zoneType.value = zone
logList.value = tempChinaLogs.value.map((el) => {
......@@ -780,21 +829,7 @@ onMounted(() => {
style="width: 150px"
/>
</ElFormItem>
<ElFormItem label="物流类型">
<ElSelect
v-model="searchForm.shipmentType"
placeholder="物流类型"
clearable
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['自有物流', '工厂物流']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="物流跟踪号">
<ElInput
v-model.trim="searchForm.trackingNumber"
......@@ -962,6 +997,37 @@ onMounted(() => {
style="width: 150px"
></ElInput>
</ElFormItem>
<ElFormItem label="是否代发">
<ElSelect
v-model="searchForm.replaceShipment"
placeholder="是否代发"
clearable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['不代发', '代发']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem v-if="searchForm.replaceShipment || searchForm.replaceShipment===0" label="物流类型">
<ElSelect
v-model="searchForm.shipmentType"
placeholder="物流类型"
clearable
style="width: 150px"
>
<ElOption
v-for="(item, index) in searchForm.replaceShipment === 0? ['自提', '快递']:['自有物流', '工厂物流']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<!-- <ElFormItem label="Base SKU">
<ElInput
v-model.trim="searchForm.baseSku"
......@@ -1006,6 +1072,13 @@ onMounted(() => {
</span>
</ElFormItem>
<ElFormItem>
<span>
<ElButton type="success" @click="refreshAddress"
>刷新地址</ElButton
>
</span>
</ElFormItem>
<ElFormItem>
<ElButton type="success" @click="exportData">导出</ElButton>
</ElFormItem>
</ElForm>
......@@ -1019,6 +1092,7 @@ onMounted(() => {
<div class="table-container">
<TableView
ref="tableRef"
:row-click-select="true"
:columns="tableColumns"
:serial-numberable="true"
:selectionable="true"
......@@ -1031,7 +1105,10 @@ onMounted(() => {
<div>{{ getStatus(row.status) }}</div>
</template>
<template #shipmentType="{ row }">
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
{{ (row.replaceShipment === 0 ? ['自提', '快递'] : ['自有物流', '工厂物流'])[row.shipmentType] }}
</template>
<template #replaceShipment="{ row }">
{{['不代发', '代发'][row.replaceShipment] }}
</template>
</TableView>
</div>
......@@ -1054,8 +1131,8 @@ onMounted(() => {
</template>
<template #other>
<div class="bottom-table">
<el-tabs>
<el-tab-pane label="商品明细">
<el-tabs v-model="tabValue">
<el-tab-pane name="1" label="商品明细">
<TableView
ref="goodsRef"
v-loading="goodsLoading"
......@@ -1068,7 +1145,7 @@ onMounted(() => {
</template>
</TableView>
</el-tab-pane>
<el-tab-pane label="操作日志" @tab-click="operationLog">
<el-tab-pane name="2" label="操作日志" @tab-click="operationLog">
<div>
<el-button
:type="zoneType === 'Asia/Shanghai' ? 'primary' : ''"
......@@ -1076,7 +1153,8 @@ onMounted(() => {
link
style="margin-left: 10px"
@click="changeChinaTime('Asia/Shanghai')"
>北京时间</el-button
>北京时间
</el-button
>
<el-button
:type="zoneType === 'America/New_York' ? 'primary' : ''"
......@@ -1084,7 +1162,8 @@ onMounted(() => {
link
style="margin-left: 10px"
@click="changeChinaTime('America/New_York')"
>新泽西时间</el-button
>新泽西时间
</el-button
>
<el-button
:type="zoneType === 'America/Los_Angeles' ? 'primary' : ''"
......@@ -1092,7 +1171,8 @@ onMounted(() => {
link
style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')"
>洛杉矶时间</el-button
>洛杉矶时间
</el-button
>
</div>
......@@ -1223,9 +1303,11 @@ onMounted(() => {
}
}
}
.search-form {
::v-deep .el-radio-button {
width: 75px;
.el-radio-button__inner {
width: 100%;
}
......
......@@ -26,31 +26,7 @@
></el-option>
</ElSelect>
</ElFormItem>
<ElFormItem label="平台">
<ElSelect
v-model="searchForm.platform"
value-key=""
placeholder="请选择"
clearable
filterable
popper-class="customize-select-style"
style="width: 150px"
>
<ElOption
v-for="(item, index) in platformJson"
:key="index"
:label="item.type"
:value="item.type"
style="width: 160px"
>
<img
:src="`/images/icon/${item.icon.split('/').pop()}`"
style="height: 20px; margin: 5px 10px 0 0"
/>
<span :title="item.type">{{ item.type }}</span>
</ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="工艺">
<LogisticsWaySelect
......@@ -117,6 +93,31 @@
></el-option>
</ElSelect>
</ElFormItem>
<ElFormItem label="平台">
<ElSelect
v-model="searchForm.platform"
value-key=""
placeholder="请选择"
clearable
filterable
popper-class="customize-select-style"
style="width: 150px"
>
<ElOption
v-for="(item, index) in platformJson"
:key="index"
:label="item.type"
:value="item.type"
style="width: 160px"
>
<img
:src="`/images/icon/${item.icon.split('/').pop()}`"
style="height: 20px; margin: 5px 10px 0 0"
/>
<span :title="item.type">{{ item.type }}</span>
</ElOption>
</ElSelect>
</ElFormItem>
<!-- </div> -->
<ElFormItem label="类型">
<el-radio-group
......@@ -821,6 +822,11 @@
>
</span>
</ElFormItem>
<ElFormItem v-if="['WAIT_TRACK'].includes(status) && waitTrackStatus === 5">
<span class="item">
<ElButton type="success" @click="reissueOrder">补发</ElButton>
</span>
</ElFormItem>
</ElForm>
</div>
<div class="header-filter-tab">
......@@ -2954,6 +2960,7 @@ import {
getCustomTagListApi,
getLogisticsWayApi,
printNormalPickPdfApi,
reissueOrderApi
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -6230,6 +6237,34 @@ const setFinish = async () => {
loading.close()
}
}
const reissueOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
await ElMessageBox.confirm('是否补发?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await reissueOrderApi(
selection.value.map((item) => item.id).join(','),
)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
await loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
// 完成发货
const completeDelivery = async () => {
......
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