Commit 7d2db864 by wuqian

Merge branch 'dev' of 47.122.114.111:qinjianhui/factory_front into wq

parents af73c5b4 0c00b4fe
......@@ -7,10 +7,10 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
AmountInput: typeof import('./src/components/Form.vue/AmountInput.vue')['default']
AmountInput: typeof import('./src/components/Form/AmountInput.vue')['default']
CommonCard: typeof import('./src/components/CommonCard.vue')['default']
DatePicker: typeof import('./src/components/Form.vue/DatePicker.vue')['default']
DateRangePicker: typeof import('./src/components/Form.vue/DateRangePicker.vue')['default']
DatePicker: typeof import('./src/components/Form/DatePicker.vue')['default']
DateRangePicker: typeof import('./src/components/Form/DateRangePicker.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
......@@ -53,18 +53,20 @@ declare module 'vue' {
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
Icon: typeof import('./src/components/Icon.vue')['default']
ImageView: typeof import('./src/components/ImageView.vue')['default']
LogList: typeof import('./src/components/LogList.vue')['default']
NavMenu: typeof import('./src/components/NavMenu.vue')['default']
RenderColumn: typeof import('./src/components/RenderColumn.vue')['default']
RightClickMenu: typeof import('./src/components/RightClickMenu.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Select: typeof import('./src/components/Form.vue/Select.vue')['default']
Select: typeof import('./src/components/Form/Select.vue')['default']
ShipmentOrderDetail: typeof import('./src/components/ShipmentOrderDetail.vue')['default']
SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default']
'Switch ': typeof import('./src/components/Form.vue/Switch .vue')['default']
TableRightMenu: typeof import('./src/components/TableRightMenu.vue')['default']
'Switch ': typeof import('./src/components/Form/Switch .vue')['default']
TableRightClickMenu: typeof import('./src/components/TableRightClickMenu.vue')['default']
TableView: typeof import('./src/components/TableView.vue')['default']
UploadExcel: typeof import('./src/components/UploadExcel.vue')['default']
UploadImage: typeof import('./src/components/UploadImage.vue')['default']
......
......@@ -4,7 +4,7 @@ import { showError } from '@/utils/ui.ts'
const axios = Axios.create({
baseURL: import.meta.env.VITE_API_BASE,
timeout: 30000,
timeout: 300000, //凯哥让改的超时时间
})
const TOKEN_KEY = 'token'
......
......@@ -18,6 +18,38 @@ export interface LogisticsData {
partition: string // 所在分区
logisticsWayId?: number | null
}
export interface AddressInfo {
id?:string
receiverName: string,
receiverPhone: string,
receiverCountry: string,
receiverProvince: string,
receiverCity: string,
receiverDistrict: string,
receiverAddress1: string,
receiverAddress2: string,
receiverPostCode: string,
}
// 同步收货地址
export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/syncReceiverAddress',
data,
)
}
export function refreshAddressApi(idList: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/syncReceiverAddress',
idList,
)
}
export function updateAddressApi(data: PodUsOrderListData) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/updateReceiverAddress',
data,
)
}
export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>(
'/factory/podJomallOrderUs/findStateGroupList',
......@@ -306,6 +338,14 @@ export function createLogisticsOrderApi(params: {
params,
)
}
// 更改物流
export function composingDesignImages(data:number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/composingDesignImages',
data
)
}
// 转至待拣胚
export function updateLogisticsToPickingApi(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>(
......
......@@ -2,12 +2,12 @@ import { defineComponent, PropType, ref, computed, h } from 'vue'
import type { Component } from 'vue'
import { ElInput, ElForm, ElFormItem } from 'element-plus'
import type { FormInstance } from 'element-plus'
import AmountInput from './Form.vue/AmountInput.vue' // 金额输入框
import DateRangePicker from './Form.vue/DateRangePicker.vue' // 时间范围选择器
import DatePicker from './Form.vue/DatePicker.vue' // 单个日期选择器
import Select from './Form.vue/Select.vue' // 普通下拉选择框
import Switch from './Form.vue/Switch .vue'
import './Form.vue/form.scss'
import AmountInput from './Form/AmountInput.vue' // 金额输入框
import DateRangePicker from './Form/DateRangePicker.vue' // 时间范围选择器
import DatePicker from './Form/DatePicker.vue' // 单个日期选择器
import Select from './Form/Select.vue' // 普通下拉选择框
import Switch from './Form/Switch .vue'
import './Form/form.scss'
import type { FormItemRule } from 'element-plus'
......
<template>
<div
v-show="visible"
class="right-click-menu"
:style="{ left: position.x + 'px', top: position.y + 'px' }"
>
<div class="menu-item" @click="onChangeCopy('select-all')">全部选择</div>
<div class="menu-item" @click="onChangeCopy('cancel-select')">取消选择</div>
<div
v-if="showCopySubShopNumber"
class="menu-item"
@click="onChangeCopy('copy_code')"
>
复制生产单号
</div>
<div
v-if="showCopyShopNumber"
class="menu-item"
@click="onChangeCopy('copy_shopNumber')"
>
复制店铺单号
</div>
<div v-if="showCopyCount" class="menu-item" @click="onChangeCopy('count')">
统计数量
</div>
<slot></slot>
</div>
</template>
<script setup lang="ts">
import { ref, defineExpose, onMounted, onUnmounted } from 'vue'
const visible = ref(false)
const position = ref({ x: 0, y: 0 })
const emit = defineEmits(['onChange'])
defineProps({
showCopyShopNumber: {
type: Boolean,
default: true,
},
showCopyCount: {
type: Boolean,
default: true,
},
showCopySubShopNumber: {
type: Boolean,
default: true,
},
})
const setPosition = ({ x, y }: { x: number; y: number }) => {
position.value = { x, y }
visible.value = true
}
const onChangeCopy = (value: string) => {
emit('onChange', value)
visible.value = false
}
// 点击其他地方关闭菜单
const handleClickOutside = () => {
if (visible.value) {
visible.value = false
}
}
// 监听全局点击事件
onMounted(() => {
document.addEventListener('click', handleClickOutside)
})
onUnmounted(() => {
document.removeEventListener('click', handleClickOutside)
})
defineExpose({
setPosition,
})
</script>
<style scoped lang="scss">
.right-click-menu {
position: fixed;
background: white;
border: 1px solid #e4e7ed;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
z-index: 3000;
}
.right-click-menu {
:deep(.menu-item) {
padding: 8px 16px;
cursor: pointer;
font-size: 14px;
color: #606266;
}
}
.right-click-menu {
:deep(.menu-item):hover {
background-color: #f5f7fa;
color: #409eff;
}
}
</style>
import { defineComponent, PropType, ref, computed, watch, h } from 'vue'
import type { Component } from 'vue'
import AmountInput from './Form.vue/AmountInput.vue' // 金额输入框
import DateRangePicker from './Form.vue/DateRangePicker.vue' // 时间范围选择器
import DatePicker from './Form.vue/DatePicker.vue' // 单个日期选择器
import Select from './Form.vue/Select.vue' // 普通下拉选择框
import AmountInput from './Form/AmountInput.vue' // 金额输入框
import DateRangePicker from './Form/DateRangePicker.vue' // 时间范围选择器
import DatePicker from './Form/DatePicker.vue' // 单个日期选择器
import Select from './Form/Select.vue' // 普通下拉选择框
import { ElInput, ElForm, ElFormItem, ElButton } from 'element-plus'
import {
ISearchForm,
......
<template>
<div
v-if="tableRightMenuVisible"
class="table-right-menu"
:style="{
left: rightMenuOptions.contextMenuX + 'px',
top: rightMenuOptions.contextMenuY + 'px',
}"
>
<div
class="table-right-menu-item"
@click="handleChange('copy_shop_number')"
>
<span>复制店铺单号</span>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineProps({
tableRightMenuVisible: {
type: Boolean,
default: false,
},
})
const emit = defineEmits(['onCopyChange'])
const handleChange = (type: string) => {
emit('onCopyChange', type)
}
const rightMenuOptions = ref({
contextMenuX: 0,
contextMenuY: 0,
})
const setRightMenuOptions = (options: {
contextMenuX: number
contextMenuY: number
}) => {
rightMenuOptions.value = options
}
defineExpose({
setRightMenuOptions,
})
</script>
<style lang="scss" scoped>
.table-right-menu {
position: fixed;
z-index: 1000;
border: 1px solid #ccc;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
padding: 6px;
}
.table-right-menu-item {
padding: 5px;
cursor: pointer;
font-size: 14px;
&:hover {
background-color: #f0f0f0;
}
}
</style>
......@@ -64,7 +64,10 @@ import { type Slot, useAttrs, useSlots, type PropType, shallowRef } from 'vue'
import type { CustomColumn } from '@/types/table'
import RenderColumn from './RenderColumn.vue'
import { ElTable } from 'element-plus'
const tableRef = shallowRef<InstanceType<typeof ElTable>>()
import type { TableInstance } from 'element-plus'
const tableRef = shallowRef<TableInstance>()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
defineProps({
paginatedData: {
......@@ -88,23 +91,31 @@ defineProps({
default: false,
},
})
const attrs = useAttrs()
const slots = useSlots() as Record<string, Slot>
const setCurrentRow = (row: T) => {
tableRef.value?.setCurrentRow(row)
}
const toggleRowSelection = (row: T, selected: boolean = true) => {
tableRef.value?.toggleRowSelection(row, selected)
}
const clearSelection = () => {
tableRef.value?.clearSelection()
}
const toggleAllSelection = () => {
tableRef.value?.toggleAllSelection()
}
defineExpose({
tableRef,
setCurrentRow,
toggleRowSelection,
clearSelection,
toggleAllSelection,
})
</script>
......@@ -112,5 +123,6 @@ defineExpose({
.table-view {
height: 100%;
overflow: hidden;
position: relative;
}
</style>
......@@ -6,6 +6,7 @@ export interface Tab {
export interface SearchForm {
timeType: number | null
shopNumber: string
shipmentType: string
userMark: string
logisticsTracking: string
baseSku: string
......
......@@ -101,6 +101,7 @@ const [editForm, resetEditForm] = useValue<AddDeclarationRuleObj>({
currency: 'USD',
})
const {
loading,
currentPage,
pageSize,
total,
......@@ -466,7 +467,7 @@ const tableConfig = ref<TableColumn[]>([
},
])
const loading = ref(false)
// const loading = ref(false)
/**
* @description: 取消按钮
......
......@@ -436,7 +436,7 @@ onMounted(() => {
})
async function search() {
loading.value = true
// loading.value = true
const isEqual =
JSON.stringify(searchForm.value) === JSON.stringify({ logisticsIdList: [] })
try {
......@@ -448,7 +448,7 @@ async function search() {
} catch (e) {
console.log(e)
} finally {
loading.value = false
// loading.value = false
}
}
......@@ -729,6 +729,7 @@ function handleSizeChange(val: number) {
}
async function getList() {
loading.value = true
try {
const { data } = await getlogisticsQuotationPage({
...searchForm.value,
......@@ -741,10 +742,13 @@ async function getList() {
mergeCells.value = []
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
const templeData = ref<LogisticsQuotation[]>([])
async function getSearchList() {
loading.value = true
try {
const { data } = await getlogisticsQuotationList({
...searchForm.value,
......@@ -784,6 +788,8 @@ async function getSearchList() {
mergeCells.value = newMergeCells
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
......
......@@ -271,9 +271,11 @@
v-loading="loading"
element-loading-text="加载中..."
class="order-list flex-1 overflow-hidden"
@contextmenu.prevent="handleContextMenu"
>
<ElTable
v-show="statusCode !== 6"
ref="tableRef"
:data="tableData"
:span-method="arraySpanMethod"
default-expand-all
......@@ -597,6 +599,7 @@
</ElTable>
<ElTable
v-show="statusCode === 6"
ref="tableQaRef"
:data="tableData"
:span-method="arraySpanMethod"
default-expand-all
......@@ -973,6 +976,13 @@
>
<OrderDetail :order-detail-data="orderDetailData" />
</ElDrawer>
<RightClickMenu
ref="rightMenuRef"
:show-copy-shop-number="true"
:show-copy-count="false"
:show-copy-sub-shop-number="true"
@on-change="rightChange"
/>
</template>
<script setup lang="ts">
import Shipment from './Shipment.vue'
......@@ -990,7 +1000,12 @@ import type {
} from '@/types/api/order'
import { nextTick, onMounted, reactive, ref } from 'vue'
import useElTableColumnWidth from '@/utils/hooks/useElTableColumnWidth'
import { ArrowDown, ArrowUp, DocumentCopy, EditPen } from '@element-plus/icons-vue'
import {
ArrowDown,
ArrowUp,
DocumentCopy,
EditPen,
} from '@element-plus/icons-vue'
import usePageList from '@/utils/hooks/usePageList'
import {
getOrderList,
......@@ -1023,6 +1038,7 @@ import OrderDetail from './OrderDetail.vue'
import useShipment from './hook/useShipment'
import useQuarantine from './hook/useQuarantine'
import Quarantine from './Quarantine.vue'
import RightClickMenu from '@/components/RightClickMenu.vue'
const [searchForm] = useValue<SearchForm>({
mainSku: '',
......@@ -1644,7 +1660,70 @@ const cancelOrder = async (id: number) => {
// showError(e)
}
}
const rightMenuRef = ref()
const handleContextMenu = (e: MouseEvent) => {
rightMenuRef.value?.setPosition({
x: e.clientX,
y: e.clientY,
cardItem: e.clientY,
el: e,
})
}
const tableQaRef = ref()
const tableRef = ref()
const rightChange = (key: string) => {
if (key === 'select-all') {
if (statusCode.value === 6) {
tableQaRef.value?.toggleAllSelection()
} else {
tableRef.value?.toggleAllSelection()
}
} else if (key === 'cancel-select') {
if (statusCode.value === 6) {
tableQaRef.value?.clearSelection()
} else {
tableRef.value?.clearSelection()
}
} else if (key === 'copy_shopNumber') {
let shopNumberList: string[] = []
if (statusCode.value === 6) {
shopNumberList = tableData.value
.map((item) => item.detailList)
.flat()
.map((e) => e?.shopNumber)
.filter((shopNumber): shopNumber is string => shopNumber !== undefined)
} else {
shopNumberList = tableData.value
.map((item) => item.productList)
.flat()
.map((e) => e?.shopNumber)
.filter((shopNumber): shopNumber is string => shopNumber !== undefined)
}
copy(shopNumberList.join(','))
} else if (key === 'copy_code') {
let subOrderNumber: string[] = []
if (statusCode.value === 6) {
subOrderNumber = tableData.value
.map((item) => item.detailList)
.flat()
.map((e) => e?.subOrderNumber)
.filter(
(subOrderNumber): subOrderNumber is string =>
subOrderNumber !== undefined,
)
} else {
subOrderNumber = tableData.value
.map((item) => item.productList)
.flat()
.map((e) => e?.subOrderNumber)
.filter(
(subOrderNumber): subOrderNumber is string =>
subOrderNumber !== undefined,
)
}
copy(subOrderNumber.join(','))
}
}
const onChangeCurrentRow = (item: ProductList) => {
currentRow.value = item
}
......
......@@ -231,7 +231,12 @@
v-if="['TO_BE_CONFIRMED', 'IN_PRODUCTION'].includes(status)"
class="item"
>
<ElButton :loading="syncLoading" type="warning" is-dark @click="synchronousPlan">
<ElButton
:loading="syncLoading"
type="warning"
is-dark
@click="synchronousPlan"
>
同步素材图</ElButton
>
</span>
......@@ -548,7 +553,6 @@
{{ cardItem?.productionFileId }}
</span>
</el-tooltip>
</a>
</el-col>
<el-col
......@@ -586,15 +590,17 @@
v-loading="loading"
element-loading-text="加载中..."
class="order-list flex-1 overflow-hidden"
@contextmenu.prevent="(v) => rightClick(v, null)"
>
<TableView
ref="tableRef"
:paginated-data="tableData"
:columns="tableColumns"
:selectionable="true"
default-expand-all
:span-method="arraySpanMethod"
@selection-change="handleSelectionChange"
@contextmenu.prevent="handleContextMenu"
@on-change="onChange"
>
<template #expand="{ row }">
<div v-if="row.productList" class="table-expand">
......@@ -969,12 +975,20 @@
基版 <b>{{ cardItem?.baseSku }}</b> 的统计数量为:<b> {{ count }}</b>
</p>
</el-dialog>
<right-menu
<RightClickMenu
ref="rightMenuRef"
:show-copy-shop-number="
['IN_PRODUCTION', 'TO_BE_CONFIRMED', 'WAIT_SHIPMENT'].includes(status)
:show-copy-shop-number="true"
:show-copy-count="
[
'IN_PRODUCTION',
'TO_BE_CONFIRMED',
'WAIT_SHIPMENT',
'TO_BE_REPLENISHMENT',
'INVALID',
].includes(status)
"
@change="rightChange"
:show-copy-sub-shop-number="true"
@on-change="rightChange"
/>
<fastProduction
v-model:detailVisible="detailVisible"
......@@ -986,11 +1000,6 @@
@on-success="handleSuccess"
@close="fastClose"
></fastProduction>
<table-right-menu
ref="tableRightMenuRef"
:table-right-menu-visible="tableRightMenuVisible"
@on-copy-change="onCopyChange"
/>
<el-dialog
v-model="completeShipmentVisible"
title="完成发货"
......@@ -1056,7 +1065,6 @@
</template>
<script setup lang="tsx">
// refreshJMProductInfo,reasonInvalidationApi,
import RightMenu from './rightMenu.vue'
import {
getOrderTabData,
getOrderList,
......@@ -1105,7 +1113,6 @@ import {
SearchForm,
Tab,
LogListData,
PodProductList,
cardImages,
imageAryInter,
......@@ -1119,6 +1126,7 @@ import { filePath } from '@/api/axios'
import { CustomColumn } from '@/types/table'
import LogList from '@/components/LogList.vue'
import CommonCard from '@/components/CommonCard.vue'
import RightClickMenu from '@/components/RightClickMenu.vue'
const tableRef = ref()
const loading = ref(false)
const currentPage = ref(1)
......@@ -1153,13 +1161,14 @@ const completeShipmentForm = ref({
logisticsTracking: '', // 物流跟踪号
carriageAmount: '', // 物流费用
})
const rightClick = (e: MouseEvent, item: PodProductList | CardOrderData) => {
cardItem.value = item
const rightClick = (
e: MouseEvent,
item: PodProductList | CardOrderData | null,
) => {
cardItem.value = item || undefined
rightMenuRef.value.setPosition({
x: e.clientX,
y: e.clientY,
cardItem: e.clientY,
el: e,
})
}
const handleSizeChange = (size: number) => {
......@@ -1171,10 +1180,14 @@ const handleCurrentChange = (page: number) => {
loadDiffList()
}
const rightChange = async (code: string) => {
const flag = ['IN_PRODUCTION', 'TO_BE_CONFIRMED', 'WAIT_SHIPMENT'].includes(
status.value,
)
if (code === 'check_all') {
const flag = [
'IN_PRODUCTION',
'TO_BE_CONFIRMED',
'WAIT_SHIPMENT',
'TO_BE_REPLENISHMENT',
'INVALID',
].includes(status.value)
if (code === 'select-all') {
if (flag) {
selection.value = JSON.parse(JSON.stringify(CardOrderList.value))
} else {
......@@ -1183,17 +1196,35 @@ const rightChange = async (code: string) => {
}
// selection.value = JSON.parse(JSON.stringify(tableData.value))
}
} else if (code === 'clear_check') {
} else if (code === 'cancel-select') {
selection.value = []
tableRef.value?.tableRef.toggleAllSelection()
} else if (code === 'copy_code') {
const str = selection.value
.map((item) => item.factorySubOrderNumber || item.factoryOrderNumber)
let str
if (flag) {
str = CardOrderList.value.map((item) => item.factorySubOrderNumber).join()
} else {
str = tableData.value
.map((item) => item.productList)
.flat()
.map((item) => item?.factorySubOrderNumber)
.filter((item) => item)
.join()
navigator.clipboard.writeText(str)
}
navigator.clipboard.writeText(str || '')
ElMessage.success('复制成功')
} else if (code === 'copy_shopNumber') {
const str = selection.value.map((item) => item.shopNumber).join()
let str
if (flag) {
str = CardOrderList.value.map((item) => item.shopNumber).join()
} else {
str = tableData.value
.map((item) => item.productList)
.flat()
.map((item) => item?.shopNumber)
.filter((item) => item)
.join()
}
navigator.clipboard.writeText(str)
ElMessage.success('复制成功')
} else if (code === 'count') {
......@@ -1341,6 +1372,7 @@ const saveCompleteShipment = async () => {
const CardOrderList = ref<(PodProductList | CardOrderData)[]>([])
const loadCardList = async () => {
loading.value = true
try {
const res = await getCardOrderList(
{
......@@ -1379,7 +1411,17 @@ const loadCardList = async () => {
item.images = images
} else {
if (item.imageAry) {
const images = JSON.parse(item.imageAry as string)
console.log(item.imageAry)
let images
if (
typeof item.imageAry === 'string' &&
item.imageAry.startsWith('https')
) {
images = []
} else {
images = JSON.parse(item.imageAry as string)
}
if (Array.isArray(images)) {
item.images = images.map((e: imageAryInter) => {
return {
......@@ -1395,10 +1437,14 @@ const loadCardList = async () => {
})
total.value = res.data.total
} catch (error) {
console.error(error)
// showError(error)
} finally {
loading.value = false
}
}
const loadOrderList = async () => {
loading.value = true
try {
const res = await getOrderList(
{
......@@ -1421,6 +1467,8 @@ const loadOrderList = async () => {
total.value = res.data.total
} catch (error) {
// showError(error)
} finally {
loading.value = false
}
}
const currentImage = ref('')
......@@ -1825,7 +1873,9 @@ const synchronousPlan = async () => {
return
}
try {
const res = await syncSubOrderDesignImages(selection.value.map(item=>item.id))
const res = await syncSubOrderDesignImages(
selection.value.map((item) => item.id),
)
await loadDiffList()
await loadTabData()
syncLoading.value = false
......@@ -2161,10 +2211,8 @@ const invalidOrder = async (row: ProductList) => {
}
})
}
const tableRightMenuVisible = ref(false)
const tableRightMenuRef = ref()
const onCopyChange = (type: string) => {
if (type === 'copy_shop_number') {
const onChange = (type: string) => {
if (type === 'shop-numbers') {
const shopNumberList = []
for (const item of tableData.value) {
if (item.productList) {
......@@ -2174,16 +2222,6 @@ const onCopyChange = (type: string) => {
copy(shopNumberList.join(','))
}
}
const handleContextMenu = (e: MouseEvent) => {
tableRightMenuVisible.value = true
tableRightMenuRef.value?.setRightMenuOptions({
contextMenuX: e.clientX,
contextMenuY: e.clientY,
})
}
const listenerClick = () => {
tableRightMenuVisible.value = false
}
const getUserMark = async () => {
try {
......@@ -2208,7 +2246,6 @@ const openMaterial = async (item: PodProductList) => {
}
onMounted(async () => {
document.addEventListener('keydown', listenerKeydown)
document.addEventListener('click', listenerClick)
await loadTabData()
getUserMark()
getLogisticsList()
......@@ -2216,7 +2253,6 @@ onMounted(async () => {
})
onBeforeUnmount(() => {
document.removeEventListener('keydown', listenerKeydown)
document.removeEventListener('click', listenerClick)
})
</script>
<style lang="scss" scoped>
......@@ -2491,9 +2527,9 @@ onBeforeUnmount(() => {
display: flex;
align-items: center;
}
.over-hidden{
.over-hidden {
width: 150px;
display:inline-block;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
......
<template>
<!-- <div class="wrap" @click="close"> -->
<div v-if="show" ref="right_menu" class="right_menu">
<button @click="$emit('change', 'check_all')">
全部选择
</button>
<button @click="$emit('change', 'clear_check')">取消选择</button>
<button @click="$emit('change', 'copy_code')">复制选中生产单号</button>
<button v-if="showCopyShopNumber" @click="$emit('change', 'copy_shopNumber')">复制选中店铺单号</button>
<button v-if="showCopyShopNumber" @click="$emit('change', 'count')">统计数量</button>
</div>
<!-- </div> -->
</template>
<script setup lang="ts">
import {ref,defineProps,defineExpose} from 'vue'
interface E{
x:number
el:HTMLElement
y:number
}
defineProps({
showCopyShopNumber:{
type:Boolean,
default:true
}
})
const row = ref()
const show = ref(false)
const right_menu = ref<HTMLElement>()
const close = ()=>{
show.value = false
document.body.onclick = null
}
const setPosition = (o:E)=> {
console.log(o)
show.value = true
const clientX = o.x
const x = document.body.clientWidth - clientX
document.body.onclick = function () {
close()
}
row.value =
setTimeout(() => {
if(!right_menu.value) return
if (x < 150) {
right_menu.value.style.cssText = `top:${o.y}px;right:${x}px`
} else {
right_menu.value.style.cssText = `top:${o.y}px;left:${o.x}px`
}
}, 1)
}
defineExpose({
setPosition
})
</script>
<style scoped>
.wrap {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.right_menu {
position: fixed;
max-width: 200px;
min-height: 50px;
background: #fff;
box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5);
border-radius: 5px;
overflow: hidden;
z-index: 999;
/* left: -500px; */
top: -500px;
}
.right_menu button {
display: block;
line-height: 30px;
font-size: 14px;
padding: 0 15px;
text-align: left;
width: 100%;
cursor: pointer;
}
.right_menu button:hover {
background: rgb(65, 192, 251);
color: white;
}
button{
outline: none;
border: none;
}
</style>
......@@ -74,7 +74,7 @@ const checkAll = ref(false)
const selectedList = ref<(string | number)[]>([])
// 显示弹窗
const showDialog = (type: string) => {
const showDialog = (type?: string) => {
console.log(type)
resultDialog.value = true
......
<script setup lang="ts">
import { defineModel } from 'vue'
import { updateAddressApi,AddressInfo } from '@/api/podUsOrder.ts'
const emits = defineEmits(['success'])
defineProps<{
countryList: { countryCode: string }[]
}>()
const visible = defineModel<boolean>('visible')
const form = defineModel<AddressInfo>('form', {
default: {
receiverName: '',
receiverPhone: '',
receiverCountry: '',
receiverProvince: '',
receiverCity: '',
receiverDistrict: '',
receiverAddress1: '',
receiverAddress2: '',
receiverPostCode: '',
},
})
const formRef = ref()
const rules = {
receiverName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
receiverPhone: [{ required: true, message: '请输入电话', trigger: 'blur' }],
receiverCountry: [{ required: true, message: '请输入国家', trigger: 'blur' }],
receiverProvince: [{ required: true, message: '请输入省/州', trigger: 'blur' }],
receiverCity: [{ required: true, message: '请输入市', trigger: 'blur' }],
receiverAddress1: [{ required: true, message: '请输入地址1', trigger: 'blur' }],
receiverPostCode: [{ required: true, message: '请输入邮政编码', trigger: 'blur' }],
}
const submitForm = async () => {
formRef?.value.validate(async (valid: boolean) => {
if (valid) {
await updateAddressApi(form.value as never)
visible.value = false
emits('success')
await ElMessageBox.alert('请修改/刷新地址后取消物流重新创建物流订单、获取跟踪号、获取打印面单。', '提示', {
type: 'warning',
confirmButtonText:'确定',
cancelButtonText:'取消',
showCancelButton: true,
})
}
})
}
</script>
<template>
<el-dialog
v-model="visible"
:close-on-click-modal="false"
title="修改揽收信息"
width="50%"
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="姓名" prop="receiverName">
<el-input v-model="form.receiverName" clearable placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="电话" prop="receiverPhone">
<el-input v-model="form.receiverPhone" clearable placeholder="请输入电话" />
</el-form-item>
<el-form-item label="国家" prop="receiverCountry">
<el-select v-model="form.receiverCountry" clearable filterable>
<el-option
v-for="it in countryList" :key="it.countryCode" :label="it.countryCode"
:value="it.countryCode"></el-option>
</el-select>
</el-form-item>
<el-form-item label="省/州" prop="receiverProvince">
<el-input v-model="form.receiverProvince" clearable placeholder="请输入省/州" />
</el-form-item>
<el-form-item label="市" prop="receiverCity">
<el-input v-model="form.receiverCity" clearable placeholder="请输入市" />
</el-form-item>
<el-form-item label="区/县" prop="receiverDistrict">
<el-input v-model="form.receiverDistrict" clearable placeholder="请输入区/县" />
</el-form-item>
<el-form-item label="地址1" prop="receiverAddress1">
<el-input v-model="form.receiverAddress1" clearable placeholder="请输入地址1" />
</el-form-item>
<el-form-item label="地址2" prop="receiverAddress2">
<el-input v-model="form.receiverAddress2" clearable placeholder="请输入地址2" />
</el-form-item>
<el-form-item label="邮政编码" prop="receiverPostCode">
<el-input v-model="form.receiverPostCode" clearable placeholder="请输入邮政编码" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible=false">取消</el-button>
<el-button type="primary" @click="submitForm">提交</el-button>
</template>
</el-dialog>
</template>
<style scoped lang="scss">
</style>
......@@ -75,7 +75,7 @@
style="width: 160px"
>
<img
:src="`../../../src/assets/${item.icon}`"
:src="`/images/icon/${item.icon.split('/').pop()}`"
style="height: 20px; margin: 5px 10px 0 0"
/>
<span :title="item.type">{{ item.type }}</span>
......@@ -145,7 +145,21 @@
style="width: 150px"
/>
</ElFormItem>
<ElFormItem label="物流类型">
<ElSelect
v-model="searchForm.shipmentType"
placeholder="物流类型"
clearable
style="width: 130px"
>
<ElOption
v-for="(item, index) in ['自有物流', '工厂物流']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem>
<ElButton type="primary" @click="search">查询</ElButton>
</ElFormItem>
......@@ -230,6 +244,15 @@
</div>
</div>
<div class="operation-box mb-10">
<span v-if="status === 'PICKING'" class="item">
<ElButton
:loading="downloadLoading"
type="primary"
@click="downloadTif"
>
排版
</ElButton>
</span>
<span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="success" @click="confirmOrder"> 确认 </ElButton>
</span>
......@@ -237,6 +260,14 @@
<ElButton type="success" @click="updateOrder"> 转至待确认 </ElButton>
</span>
<span
v-if="status === 'EXCEPTION_ORDER' && exceptionStatus === 3"
class="item"
>
<ElButton type="success" @click="asyncOrderAddress">
同步收货地址
</ElButton>
</span>
<span
v-if="status === 'EXCEPTION_ORDER' && exceptionStatus === 1"
class="item"
>
......@@ -354,6 +385,7 @@
v-loading="loading"
element-loading-text="加载中..."
class="table-wrapper flex-1 flex-column overflow-hidden"
@contextmenu.prevent="(v) => rightClick(v)"
>
<TableView
ref="tableRef"
......@@ -573,6 +605,12 @@
</el-icon>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">物流类型:</span>
<span class="order-detail-item-value">
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
</span>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">物流跟踪号:</span>
<span class="order-detail-item-value">
<el-button
......@@ -740,6 +778,9 @@
</div>
</div> -->
</template>
<template #exceptionReason="{row}">
<div v-html="row.exceptionReason"></div>
</template>
<template #innerLabel="{ row }">
<div v-if="row.internalMemoList" class="inner-label-box">
<div
......@@ -757,7 +798,17 @@
</template>
<template #operate="{ row }">
<div class="operate-box">
<span class="operate-item">
<span
class="operate-item"
style="display: flex; flex-direction: column"
>
<ElButton
link
type="primary"
@click="operationLog(row.id, null)"
>
操作日志
</ElButton>
<ElButton
v-if="!row.expressSheet && row.status === 'TO_BE_CONFIRMED'"
link
......@@ -767,11 +818,26 @@
确认
</ElButton>
<ElButton
v-if="
row.shipmentType === 1 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)
"
link
type="primary"
@click="operationLog(row.id, null)"
@click="handleUpdateAddress(row)"
>
操作日志
修改地址
</ElButton>
<ElButton
v-if="
row.shipmentType === 0 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)
"
link
type="primary"
@click="handleRefreshAddress(row)"
>
刷新地址
</ElButton>
</span>
</div>
......@@ -915,11 +981,18 @@
></ElPagination>
</div>
</div>
<right-menu
<RightClickMenu
ref="rightMenuRef"
:show-copy-shop-number="false"
@change="rightChange"
/>
:show-copy-count="false"
:show-copy-sub-shop-number="false"
@on-change="rightChange"
>
<template #default
><div class="menu-item" @click="rightChange('order-number')">
复制订单号
</div>
</template>
</RightClickMenu>
<el-dialog
v-model="confirmDialogShow"
:close-on-click-modal="false"
......@@ -1073,8 +1146,8 @@
:title="wayDialogTitle"
>
<el-table
v-loading="isChangeWayLoading"
ref="changeWayRef"
v-loading="isChangeWayLoading"
height="400px"
class="production-client-table"
:data="logisticsWayData"
......@@ -1130,7 +1203,13 @@
</el-button>
</template>
</el-dialog>
<UpdateAddress
v-if="updateAddVisible"
v-model:form="currentRow"
v-model:visible="updateAddVisible"
:country-list="countryList"
@success="search"
></UpdateAddress>
<ElDialog
v-model="exceptionDialogVisible"
title="转为异常单"
......@@ -1219,14 +1298,19 @@ import {
getTrackingNumberApi,
getfaceSimplexFileApi,
cancelLogisticsOrderApi,
composingDesignImages,
changeLogisticsApi,
createLogisticsOrderApi,
updateLogisticsToPickingApi,
createLogisticsOrdersApi,
syncReceiverAddress,
refreshAddressApi,
AddressInfo,
// handleExceptionOrderApi,
} from '@/api/podUsOrder'
import UpdateAddress from './components/updateAddress.vue'
import { BaseRespData } from '@/types/api'
import { getAllCountryApi } from '@/api/logistics.ts'
import TableView from '@/components/TableView.vue'
import {
LogListData,
......@@ -1250,7 +1334,7 @@ import PodMakeOrder from './PodMakeOrder.vue'
import { OrderData } from '@/types/api/podMakeOrder'
import useLodop, { LODOPObject } from '@/utils/hooks/useLodop'
import dayjs from 'dayjs'
import rightMenu from '../pod/rightMenu.vue'
import RightClickMenu from '@/components/RightClickMenu.vue'
import ResultInfo from './components/ResultInfo.vue'
import { isArray, isString } from '@/utils/validate'
import platformJson from '../../../json/platform.json'
......@@ -1269,8 +1353,10 @@ declare global {
}
}
const tabsNav = ref<Tab[]>()
const updateAddVisible = ref(false)
const resultRefs = ref<InstanceType<typeof ResultInfo> | null>(null)
const confirmDialogShow = ref(false)
const downloadLoading = ref(false)
const isChangeWay = ref(false)
const confirmData = ref([])
const logisticsWayData = ref([])
......@@ -1281,6 +1367,7 @@ const detailData = ref({})
const [searchForm] = useValue<SearchForm>({
timeType: null,
shopNumber: '',
shipmentType: '',
userMark: '',
logisticsTracking: '',
baseSku: '',
......@@ -1295,6 +1382,18 @@ const [searchForm] = useValue<SearchForm>({
platform: '',
productionClient: '',
})
const countryList = ref([])
const currentRow = ref<AddressInfo>({
receiverName: '',
receiverPhone: '',
receiverCountry: '',
receiverProvince: '',
receiverCity: '',
receiverDistrict: '',
receiverAddress1: '',
receiverAddress2: '',
receiverPostCode: '',
})
const exceptionStatus = ref(1)
const userMarkList = ref<string[]>([])
const selection = ref<PodUsOrderListData[]>([])
......@@ -1353,7 +1452,34 @@ const getDateRange = (days = 0, type: 'past' | 'future' = 'past') => {
type === 'past' ? end.subtract(days, 'day') : end.add(days, 'day')
return [start.startOf('day').toDate(), end.endOf('day').toDate()]
}
const handleRefreshAddress = async (row: PodUsOrderListData) => {
try {
await showConfirm('确定刷新地址吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
await refreshAddressApi([row.id])
await ElMessageBox.alert(
'请修改/刷新地址后取消物流重新创建物流订单、获取跟踪号、获取打印面单。',
'提示',
{
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消',
showCancelButton: true,
},
)
}
const handleUpdateAddress = async (row: PodUsOrderListData) => {
const { data } = await getAllCountryApi()
countryList.value = data
currentRow.value = JSON.parse(JSON.stringify(row))
updateAddVisible.value = true
}
const getMonthRange = (months = 0, type: 'past' | 'future' = 'past') => {
const now = dayjs()
const start =
......@@ -1401,6 +1527,12 @@ const tableColumns = computed(() => [
prop: 'innerLabel',
},
{
label: '异常原因',
width: 300,
prop: 'exceptionReason',
slot: 'exceptionReason',
},
{
label: '操作',
slot: 'operate',
width: 180,
......@@ -1414,8 +1546,6 @@ const rightClick = (e: MouseEvent) => {
rightMenuRef.value.setPosition({
x: e.clientX,
y: e.clientY,
cardItem: e.clientY,
el: e,
})
}
......@@ -1426,6 +1556,44 @@ const handleSelectionChange = (val: PodUsOrderListData[]) => {
stockOutSuccessIds.value = []
}
}
const asyncOrderAddress = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await showConfirm('确定同步收货地址吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await syncReceiverAddress(ids)
if (res.code !== 200) return
await ElMessageBox.alert('同步收货地址成功,请刷新查看。', '提示', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消',
showCancelButton: true,
})
search()
await loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const changeTab = (item: Tab) => {
status.value = item.status || ''
selection.value = []
......@@ -1601,6 +1769,21 @@ const confirmOrder = async () => {
productionClientValue.value = ''
productionClientVisible.value = true
}
const downloadTif = async () => {
if (!selection.value.length) {
return ElMessage.warning('请选择数据')
}
downloadLoading.value = true
try {
const res = await composingDesignImages(selection.value.map((el) => el.id))
window.open(filePath + res.message, '_blank')
downloadLoading.value = false
} catch (e) {
downloadLoading.value = false
}
}
const loadProductionClient = async () => {
try {
const res = await getProductionClientApi()
......@@ -1880,13 +2063,28 @@ const isSelectStatused = (data: ProductList) => {
return index !== -1
}
const rightChange = async (code: string) => {
if (code === 'check_all') {
const flat = status.value !== 'IN_PRODUCTION'
if (code === 'select-all') {
if (flat) {
tableRef.value?.toggleAllSelection()
} else {
cardSelection.value = JSON.parse(JSON.stringify(tableData.value))
} else if (code === 'clear_check') {
}
} else if (code === 'cancel-select') {
if (flat) {
tableRef.value?.clearSelection()
} else {
cardSelection.value = []
} else if (code === 'copy_code') {
const str = cardSelection.value
.map((item) => item.factorySubOrderNumber)
}
} else if (code === 'copy_shopNumber') {
const str = (tableData.value as ProductList[] | PodUsOrderListData[])
.map((item) => item?.shopNumber)
.join()
navigator.clipboard.writeText(str)
ElMessage.success('复制成功')
} else if (code === 'order-number') {
const str = (tableData.value as ProductList[] | PodUsOrderListData[])
.map((item) => item?.factoryOrderNumber)
.join()
navigator.clipboard.writeText(str)
ElMessage.success('复制成功')
......@@ -2033,7 +2231,7 @@ const getOrderByIdApi = async (type: string) => {
const res = await operation.Fn(ids)
if (res.code === 200) {
if (isArray(res.data)) {
resultInfo.value = res.data
resultInfo.value = res.data || []
resultRefs.value?.showDialog(type)
} else if (isString(res.data)) {
window.open(filePath + res.data)
......@@ -2043,6 +2241,7 @@ const getOrderByIdApi = async (type: string) => {
}
loading.close()
} catch (e) {
resultInfo.value = []
console.error(e)
}
} else {
......@@ -2245,10 +2444,13 @@ const logisticsToPicking = async () => {
ids: selection.value.map((item) => item.id).join(','),
})
if (res.code !== 200) return
resultInfo.value = res.data || []
resultRefs.value?.showDialog()
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
......@@ -2756,6 +2958,13 @@ const handleExceptionCommand = (command: number) => {
}
}
}
.operate-item {
.el-button {
margin-left: 0 !important;
margin-top: 20px !important;
}
}
</style>
<style>
.customize-select-style {
......
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