Commit aeb4f4a5 by wuqian

生产中优化

parent 0704a9ce
...@@ -9,12 +9,33 @@ import { ...@@ -9,12 +9,33 @@ import {
LogListData, LogListData,
} from '@/types/api/podOrder' } from '@/types/api/podOrder'
import { OrderData, ShipmentForm } from '@/types/api/order' import { OrderData, ShipmentForm } from '@/types/api/order'
import { CardOrderData } from '@/types/api/podOrder'
export function getOrderTabData() { export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>( return axios.get<never, BaseRespData<Tab[]>>(
'factory/podJomallOrder/findStateGroupList', 'factory/podJomallOrder/findStateGroupList',
) )
} }
export function getOrderDetail(id: number) {
return axios.get<never, BaseRespData<CardOrderData>>(
'factory/podJomallOrderProduct/getSubOrderById',
{
params: {
id,
},
},
)
}
export function getSubOrderBySubOrderNumber(factorySubOrderNumber: string) {
return axios.get<never, BaseRespData<OrderData>>(
'factory/podJomallOrderProduct/getSubOrderBySubOrderNumber',
{
params: {
factorySubOrderNumber,
},
},
)
}
export function refreshJMProductInfo(data: number[]) { export function refreshJMProductInfo(data: number[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrder/refreshJomallPodProduct ', 'factory/podJomallOrder/refreshJomallPodProduct ',
...@@ -31,12 +52,21 @@ export function getOrderList( ...@@ -31,12 +52,21 @@ export function getOrderList(
{ ...data, currentPage, pageSize }, { ...data, currentPage, pageSize },
) )
} }
// 快捷生产完成
export function productionQueryApi(id: number) {
return axios.post<never, BasePaginationData<CardOrderData>>(
'factory/podJomallOrderProduct/completeDelivery',
{
id,
},
)
}
export function getCardOrderList( export function getCardOrderList(
data: SearchForm, data: SearchForm,
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
) { ) {
return axios.post<never, BasePaginationData<OrderData>>( return axios.post<never, BasePaginationData<CardOrderData>>(
'/factory/podJomallOrder/getSubListPage', '/factory/podJomallOrder/getSubListPage',
{ ...data, currentPage, pageSize }, { ...data, currentPage, pageSize },
) )
......
...@@ -27,18 +27,13 @@ ...@@ -27,18 +27,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType } from 'vue' import { PropType } from 'vue'
import type { TypesettingListData } from '../types/api/typesetting' import { PodProductList } from '@/types/api/podOrder'
defineProps({ defineProps({
cardItem: { cardItem: {
type: Object as PropType<TypesettingListData>, type: Object as PropType<PodProductList>,
required: true, required: true,
}, },
}) })
const copy = (text: string) => {
navigator.clipboard.writeText(text)
ElMessage.success('复制成功')
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -72,38 +72,6 @@ export interface OrderData { ...@@ -72,38 +72,6 @@ export interface OrderData {
manuscriptStatus?: number manuscriptStatus?: number
factoryOrderNumber?: string | undefined factoryOrderNumber?: string | undefined
} }
export interface CardOrderItem {
id: number;
podOrderId: number;
thirdSubOrderNumber: string;
factorySubOrderNumber: string;
shopNumber: string;
baseSku: string;
productName: string;
variantSku: string;
variantImage: string;
imageAry?: string | null;
designImages?: null;
process: string;
processName: string;
num: number;
shipmentNum: number;
costPrice: number;
price: number;
processPrice: number;
weight?: null;
version: number;
remark?: null;
createTime: string;
updateTime: string;
subOrderNumber?: null;
[propName: string]: string | number | boolean | undefined | unknown;
}
export interface cardImages{
ename?: string | null,
cname?: string | null,
image: string,
}
export interface ProductList { export interface ProductList {
id: number id: number
customOrderId?: number customOrderId?: number
...@@ -129,6 +97,9 @@ export interface ProductList { ...@@ -129,6 +97,9 @@ export interface ProductList {
updateTime?: string updateTime?: string
version?: string | number version?: string | number
passNum?: number passNum?: number
process?: string | null
processName?: string | null
remark?: string | null
notPassNum?: number notPassNum?: number
sendOutQuantity?: number sendOutQuantity?: number
factoryOrderNumber?: string | undefined factoryOrderNumber?: string | undefined
......
...@@ -19,7 +19,7 @@ export interface SearchForm { ...@@ -19,7 +19,7 @@ export interface SearchForm {
endTime?: string | null endTime?: string | null
internalMemo?: string internalMemo?: string
} }
export interface OrderData { export interface CardOrderData {
id: number id: number
moreable: boolean moreable: boolean
thirdOrderNumber: string thirdOrderNumber: string
...@@ -52,33 +52,68 @@ export interface OrderData { ...@@ -52,33 +52,68 @@ export interface OrderData {
remark: string | null remark: string | null
userMark: string | null userMark: string | null
namespace: string | null namespace: string | null
productList: ProductList[] productList: PodProductList[]
internalMemoList: string | null internalMemoList: string | null
[propName: string]: string | number | boolean | undefined | unknown
} }
export interface cardImages {
export interface ProductList { ename?: string | null
cname?: string | null
image: string
}
export interface imageAryInter {
sort: number
title?: string | null
url: string
}
export interface PodProductList {
id: number id: number
podOrderId?: number podOrderId: number
thirdSubOrderNumber?: string thirdSubOrderNumber?: string
factorySubOrderNumber?: string factorySubOrderNumber?: string
factoryOrderNumber?: string | null
shopNumber?: string shopNumber?: string
supplierItemNo?: string | null
baseSku?: string baseSku?: string
productName?: string productName?: string
variantSku?: string variantSku?: string
variantImage?: string variantImage?: string
imageAry?: string imageAry?: string | imageAryInter[] | null
designImages?: string images?: cardImages[] | null
process?: string designImages?: string | null
num?: number process?: string | null
podProcessName?: string | null
productionFileId?: string | null
customizedQuantity?: number
num?: number | string
shipmentNu?: number shipmentNu?: number
costPrice?: number costPrice?: number
price?: number price?: number
processPrice?: number processPrice?: number
weight?: number weight?: number | null
version?: number version?: number | null
remark?: string remark?: string | null
createTime?: string createTime?: string
updateTime?: string updateTime?: string
[propName: string]: string | number | boolean | undefined | unknown
}
export interface ImageItemInter {
url: string
title?: string | null
sort: number
id?: number | string | null
}
export type ImgList = ImageItemInter[][]
export interface PodOrderRes extends PodProductList {
expectDeliveryTime?: string | null
startStockingTime?: string | null
userMark?: string | null
color?: string | null
size?: string | null
note?: Array<{ prop: string | number; value: string | number }>
imgList: ImgList
} }
export interface ShipmentOrderRes { export interface ShipmentOrderRes {
factoryOrderNumber?: string factoryOrderNumber?: string
......
...@@ -13,17 +13,14 @@ ...@@ -13,17 +13,14 @@
</div> </div>
<div class="order-list-expand_item_info"> <div class="order-list-expand_item_info">
<div <div
:title="item.productName || '--'" :title="item?.productName || '--'"
class="order-list-expand_item_info_title" class="order-list-expand_item_info_title"
style="font-weight: bold" style="font-weight: bold"
> >
<span class="order-list-expand_item_label">商品名:</span> <span class="order-list-expand_item_label">商品名:</span>
<div class="order-list-expand_item_value"> <div class="order-list-expand_item_value">
{{ item.productName || '--' }}&emsp; {{ item?.productName || '--' }}&emsp;
<img <img
src="@/assets/images/jiaji.svg"
alt=""
width="24"
v-show=" v-show="
status == 4 && status == 4 &&
item?.num !== undefined && item?.num !== undefined &&
...@@ -34,6 +31,9 @@ ...@@ -34,6 +31,9 @@
0 && 0 &&
item.notPassNum > 0 item.notPassNum > 0
" "
src="@/assets/images/jiaji.svg"
alt=""
width="24"
/> />
</div> </div>
</div> </div>
...@@ -131,18 +131,15 @@ ...@@ -131,18 +131,15 @@
>{{ item.material || '--' }} >{{ item.material || '--' }}
</span> </span>
</div> </div>
<div <div :title="item.remark || ''" class="order-list-expand_item_info_title">
:title="(item as InterItem).remark || ''"
class="order-list-expand_item_info_title"
>
<span class="order-list-expand_item_label">备注:</span> <span class="order-list-expand_item_label">备注:</span>
<span class="order-list-expand_item_value" <span class="order-list-expand_item_value"
>{{ (item as InterItem).remark || '--' }} >{{ item.remark || '--' }}
</span> </span>
<el-icon <el-icon
class="icon" class="icon"
style="color: #e6a23c" style="color: #e6a23c"
@click="setRemarks(item.id, (item as InterItem).remark || '')" @click="setRemarks(item.id, item.remark || '')"
><EditPen ><EditPen
/></el-icon> /></el-icon>
</div> </div>
...@@ -173,13 +170,13 @@ ...@@ -173,13 +170,13 @@
<div class="order-list-expand_item_info_title"> <div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">工艺:</span> <span class="order-list-expand_item_label">工艺:</span>
<span class="order-list-expand_item_value">{{ <span class="order-list-expand_item_value">{{
item.processName || '--' !isPod ? item?.processName || '--' : item?.process || '--'
}}</span> }}</span>
</div> </div>
<div class="order-list-expand_item_info_title"> <div v-if="!isPod" class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">工艺简称:</span> <span class="order-list-expand_item_label">工艺简称:</span>
<span class="order-list-expand_item_value">{{ <span class="order-list-expand_item_value">{{
item.process || '--' item?.process || '--'
}}</span> }}</span>
</div> </div>
<div v-if="!isPod" class="order-list-expand_item_info_title"> <div v-if="!isPod" class="order-list-expand_item_info_title">
...@@ -249,11 +246,6 @@ defineProps({ ...@@ -249,11 +246,6 @@ defineProps({
default: false, default: false,
}, },
}) })
interface InterItem {
id: number
remark?: string // 可选属性
[propName: string]: string | number | boolean | undefined | unknown // 额外属性
}
// 传递多个emit 带参数的事件 // 传递多个emit 带参数的事件
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update-remark', payload: { id: number; remark: string }): void (e: 'update-remark', payload: { id: number; remark: string }): void
......
<template> <template>
<el-dialog <el-dialog
v-model="dialogVisible"
:title="title" :title="title"
:visible.sync="dialogVisible"
top="140px" top="140px"
:fullscreen="true" :fullscreen="true"
@close="emit('close')"
:close-on-click-modal="false" :close-on-click-modal="false"
@close="emit('close')"
> >
<div class="sure-btn" v-if="type === 2">
<el-button @click="changeStatus" size="small" type="success">
{{ type === 1 ? '生产完成' : '确定发货' }}
</el-button>
</div>
<div class="detail-div"> <div class="detail-div">
<div class="detail-content"> <div class="detail-content">
<div class="left"> <div class="left">
<div class="left-images"> <div class="left-images">
<el-carousel <el-carousel
v-if="detail.imgList.length > 0" v-if="detail?.imgList.length > 0"
style="height: 100%" style="height: 100%"
:autoplay="false" :autoplay="false"
indicator-position="none" indicator-position="none"
> >
<el-carousel-item <el-carousel-item
style="height: 100%" v-for="(item, index) in detail?.imgList"
:key="index" :key="index"
v-for="(item, index) in detail.imgList" style="height: 100%"
> >
<el-row :gutter="10" style="width: 100%; height: 100%"> <el-row :gutter="10" style="width: 100%; height: 100%">
<el-col <el-col
style="height: 100%"
v-for="(it, i) in item" v-for="(it, i) in item"
:key="i" :key="i"
style="height: 100%"
:span="12" :span="12"
> >
<div class="left-image"> <div class="left-image">
<b v-show="it.title && it.url"> <b v-show="it?.title && it?.url">
{{ it.title }} {{ it?.title }}
<span <span
v-if="it?.id"
style=" style="
text-decoration: underline; text-decoration: underline;
cursor: pointer; cursor: pointer;
color: blue; color: blue;
" "
@click="
downloadAllWe(
it.title && it.title === '正面' ? 1 : 2,
it.id,
)
"
v-if="it.id"
> >
(DID:{{ it.id }} (DID:{{ it?.id }}
</span> </span>
</b> </b>
<img :src="it.url" alt="" /> <img :src="it?.url" alt="" />
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -64,51 +53,37 @@ ...@@ -64,51 +53,37 @@
</div> </div>
<div class="right"> <div class="right">
<div <div
class="input"
v-if="!detailData || Object.keys(detailData).length === 0" v-if="!detailData || Object.keys(detailData).length === 0"
class="input"
> >
<el-input <el-input
ref="trackingNumberRef"
v-model="TrackingNumber" v-model="TrackingNumber"
:placeholder="placeholderText" :placeholder="placeholderText"
style="width: 660px; margin-right: 10px" style="width: 660px; margin-right: 10px"
clearable clearable
ref="trackingNumberRef" @keydown.enter="trackcodeInput()"
size="medium"
@keyup.enter.native="trackcodeInput()"
></el-input> ></el-input>
<el-button type="primary" size="medium" @click="trackcodeInput()"> <el-button type="primary" @click="trackcodeInput()">
查询 查询
</el-button> </el-button>
<!-- <el-popover-->
<!-- placement="bottom"-->
<!-- v-if="historyData.filter(el=>el.type===type).length"-->
<!-- title="未处理生产单"-->
<!-- width="300"-->
<!-- trigger="click"-->
<!-- content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">-->
<!-- <i slot="reference" class="warning el-icon-warning"></i>-->
<!-- <el-table border :data="historyData.filter(el=>el.type===type)" highlight-current-row height="400">-->
<!-- <el-table-column align="center" prop="orderNumber" label="生产单号"></el-table-column>-->
<!-- <el-table-column align="center" label="操作" width="60px">-->
<!-- <template slot-scope="{row}">-->
<!-- <el-button style="color: red" type="text" @click="delHistory(row)">删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </el-popover>-->
</div> </div>
<div class="div-text" v-if="isJMPOD === 'JMPOD'"> <div v-if="isJmpod === 'JMPOD'" class="div-text">
<div class="div-content"> <div class="div-content">
<div :title="detail.userMark" class="div-item"> <div :title="String(detail?.userMark)" class="div-item">
<span style="font-size: 18px">客户</span> <span style="font-size: 18px">客户</span>
<p style="color: red; font-size: 30px"> <p style="color: red; font-size: 30px">
{{ detail.userMark }} {{ detail?.userMark }}
</p> </p>
</div> </div>
<div :title="detail.orderNumber" class="div-item"> <div
:title="String(detail?.factoryOrderNumber)"
class="div-item"
style="margin-top: 14px"
>
<span style="font-size: 18px">订单号</span> <span style="font-size: 18px">订单号</span>
<p style="color: red; font-size: 22px"> <p style="color: red; font-size: 22px">
{{ detail.orderNumber }} {{ detail?.factoryOrderNumber }}
</p> </p>
</div> </div>
</div> </div>
...@@ -116,304 +91,85 @@ ...@@ -116,304 +91,85 @@
<div class="div-text"> <div class="div-text">
<b>生产单信息</b> <b>生产单信息</b>
<div class="div-content"> <div class="div-content">
<div <div :title="detail?.factorySubOrderNumber" class="div-item">
:title="
isJMPOD === 'JMPOD'
? detail.subOrderNumber
: detail.podProductionNo
"
class="div-item"
>
<span>生产单号</span> <span>生产单号</span>
<p> <p>
{{ {{ detail?.factorySubOrderNumber }}
isJMPOD === 'JMPOD'
? detail.subOrderNumber
: detail.podProductionNo
}}
</p>
<p
style="margin-left: 5px"
v-if="detail.podProductionNo"
:style="{
color: detail.customizedQuantity > 1 ? 'red' : '#67C23A',
}"
>
{{ detail.customizedQuantity > 1 ? '多' : '单' }}
</p> </p>
</div> </div>
<div <div :title="String(detail?.process)" class="div-item">
:title="
isJMPOD === 'JMPOD' ? detail.process : detail.podProcessName
"
class="div-item"
>
<span>生产工艺</span> <span>生产工艺</span>
<p> <p>
{{ {{ detail?.process }}
isJMPOD === 'JMPOD' ? detail.process : detail.podProcessName
}}
</p> </p>
</div> </div>
<div :title="detail.warehouseName" class="div-item"> <div :title="detail?.baseSku" class="div-item">
<span>仓库</span>
<p>{{ detail.warehouseName }}</p>
</div>
<div :title="detail.baseSku" class="div-item">
<span>基版</span> <span>基版</span>
<p>{{ detail.baseSku }}</p> <p>{{ detail?.baseSku }}</p>
</div> </div>
<div :title="detail.supplierItemNo" class="div-item"> <div :title="String(detail?.supplierItemNo)" class="div-item">
<span>货号</span> <span>货号</span>
<p>{{ detail.supplierItemNo }}</p> <p>{{ detail?.supplierItemNo }}</p>
</div> </div>
<div :title="detail.variantSku" class="div-item"> <div :title="detail?.variantSku" class="div-item">
<span>变体SKU</span> <span>变体SKU</span>
<p>{{ detail.variantSku }}</p> <p>{{ detail?.variantSku }}</p>
</div> </div>
<div :title="detail.categoryName" class="div-item"> <div :title="String(detail?.num)" class="div-item">
<span>类别</span> <span>数量</span>
<p>{{ detail.categoryName }}</p> <p>{{ detail?.num }}</p>
</div>
<div
:title="detail.color"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>颜色</span>
<p>{{ detail.color }}</p>
</div> </div>
<div <!-- <div :title="detail?.categoryName" class="div-item">
:title="detail.size" <span>类别</span>
class="div-item" <p>{{ detail?.categoryName }}</p>
v-if="isJMPOD === 'POD'" </div> -->
> <div :title="String(detail?.size)" class="div-item">
<span>尺寸</span> <span>尺寸</span>
<p>{{ detail.size }}</p> <p>{{ detail?.size }}</p>
</div> </div>
<!-- <div <!-- <div
:title="detail.material" v-if="isJmpod === 'JMPOD'"
class="div-item" :title="detail?.supplyMerchantCode"
v-if="isJMPOD === 'POD'">
<span>材质</span>
<p>{{ detail.material }}</p>
</div> -->
<div
:title="detail.batchNo"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>批次号</span>
<p>{{ detail.batchNo }}</p>
</div>
<div
:title="detail.supplyMerchantCode"
v-if="isJMPOD === 'POD' && currentStatus !== 'TO_BE_ASSIGN'"
class="div-item"
>
<span>供应商编号</span>
<p>{{ detail.supplyMerchantCode }}</p>
</div>
<div
:title="detail.supplyMerchantCode"
v-if="isJMPOD === 'JMPOD'"
class="div-item" class="div-item"
> >
<span>工厂</span> <span>工厂</span>
<p>{{ detail.factoryCode || detail.supplierCode }}</p> <p>{{ detail?.factoryCode || detail?.supplierCode }}</p>
</div> </div> -->
<div :title="detail.shopNumber" class="div-item"> <div :title="detail?.shopNumber" class="div-item">
<span>店铺单号</span> <span>店铺单号</span>
<p>{{ detail.shopNumber }}</p> <p>{{ detail?.shopNumber }}</p>
</div> </div>
<div :title="detail.shopShortName" class="div-item"> <!-- <div :title="detail?.shopShortName" class="div-item">
<span>店铺简称</span> <span>店铺简称</span>
<p>{{ detail.shopShortName }}</p> <p>{{ detail?.shopShortName }}</p>
</div>
<div
:title="detail.purchaseUserName"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>采购员</span>
<p>{{ detail.purchaseUserName }}</p>
</div>
<div
:title="detail.productionName"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>生产人</span>
<p>{{ detail.productionName || '' }}</p>
</div>
<div
:title="detail.followerName"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>跟单员</span>
<p>{{ detail.followerName }}</p>
</div>
<div
:title="detail.replenishmentNumber"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>补胚数量</span>
<p>{{ detail.replenishmentNumber }}</p>
</div>
<div
:title="detail.storedName"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>入库人</span>
<p>{{ detail.storedName }}</p>
</div>
<div
v-if="isJMPOD === 'POD'"
:title="detail.shipmentType == 1 ? '送货上门' : '快递'"
class="div-item"
>
<span>发货方式</span>
<p v-if="detail.shipmentType">
{{ detail.shipmentType == 1 ? '送货上门' : '快递' }}
</p>
</div>
<!-- <div :title="detail.purchaseUserName" class="div-item">
<span>采购员</span>
<p>{{ detail.purchaseUserName }}</p>
</div> --> </div> -->
<div :title="detail.createTime" class="div-item">
<div :title="detail?.createTime" class="div-item">
<span>创建时间</span> <span>创建时间</span>
<p>{{ detail.createTime }}</p> <p>{{ detail?.createTime }}</p>
</div> </div>
<div :title="detail.expectDeliveryTime" class="div-item"> <div :title="String(detail?.expectDeliveryTime)" class="div-item">
<span>期望交货时间</span> <span>期望交货时间</span>
<p>{{ detail.expectDeliveryTime }}</p> <p>{{ detail?.expectDeliveryTime }}</p>
</div> </div>
<div <div :title="String(detail?.startStockingTime)" class="div-item">
:title="
isJMPOD === 'JMPOD'
? detail.startStockingTime
: detail.productionConfirmTime
"
class="div-item"
>
<span>生产确认时间</span> <span>生产确认时间</span>
<p> <p>
{{ {{ detail?.startStockingTime }}
isJMPOD === 'JMPOD'
? detail.startStockingTime
: detail.productionConfirmTime
}}
</p>
</div>
<div
v-if="isJMPOD === 'POD'"
title="生产完成时间"
class="div-item"
>
<span>生产完成时间</span>
<p>
{{ detail.productionFinishTime }}
</p> </p>
</div> </div>
<div
v-if="isJMPOD === 'POD'"
:title="detail.actualDeliveryTime"
class="div-item"
>
<span>实际交货时间</span>
<p>
{{ detail.actualDeliveryTime }}
</p>
</div>
<div
v-if="isJMPOD === 'POD'"
:title="detail.storedTime"
class="div-item"
>
<span>入库时间</span>
<p>{{ detail.storedTime }}</p>
</div>
</div> </div>
</div> </div>
<div
class="form" <div v-if="type !== 2" class="btn">
style="margin: 15px 0; background: #4168ff; border-radius: 5px"
v-if="type === 2"
>
<el-form
:model="shipForm"
ref="form"
label-width="80px"
:inline="false"
size="small"
>
<el-form-item style="margin-top: 10px" label="发货方式">
<el-select
style="width: 384px"
v-model="shipForm.shipmentType"
value-key=""
placeholder="请选择"
>
<el-option label="送货上门" value="1"></el-option>
<el-option label="快递" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="物流方式"
v-if="shipForm.shipmentType == '2'"
>
<el-select
v-model="shipForm.shipmentWay"
style="width: 384px"
placeholder="请选择"
>
<el-option
v-for="(item, index) in logistics"
:key="index"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="物流单号"
v-if="shipForm.shipmentType == '2'"
>
<el-input
style="width: 384px"
v-model="shipForm.shipmentNumber"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item
label="物流费用"
v-if="shipForm.shipmentType == '2'"
>
<el-input
style="width: 384px"
v-model="shipForm.shipmentFreight"
placeholder="请输入"
></el-input>
</el-form-item>
</el-form>
</div>
<div class="btn" v-if="type !== 2">
<div class="btn-sure"> <div class="btn-sure">
<el-button <el-button
:disabled="detail.importFactory"
v-if="type !== 0" v-if="type !== 0"
style="width: 100%; height: 100%; font-size: 18px" style="width: 100%; height: 100%; font-size: 18px"
size="large" size="large"
@click="changeStatus"
type="success" type="success"
@click="changeStatus"
> >
{{ ['生产完成', '确定发货'][type - 1] }} {{ ['生产完成', '确定发货'][type - 1] }}
</el-button> </el-button>
...@@ -425,16 +181,14 @@ ...@@ -425,16 +181,14 @@
</div> </div>
<div class="btn-down"> <div class="btn-down">
<div class="check"> <div class="check">
<el-checkbox size="large" v-model="isDownloadImage"> <el-checkbox v-model="isDownloadImage" size="large">
扫码下载素材 扫码下载素材
</el-checkbox> </el-checkbox>
</div> </div>
<el-button <el-button
size="medium"
:disabled="detail.importFactory"
@click="handleDownload"
style="width: 100%; height: 100%; font-size: 18px" style="width: 100%; height: 100%; font-size: 18px"
type="primary" type="primary"
@click="handleDownload"
> >
下载素材 下载素材
</el-button> </el-button>
...@@ -450,10 +204,10 @@ ...@@ -450,10 +204,10 @@
flex-direction: column; flex-direction: column;
" "
> >
<div style="height: 100%" class="div-content" v-if="detail.note"> <div v-if="detail?.note" style="height: 100%" class="div-content">
<b style="position: absolute; top: -12px">客户留言信息</b> <b style="position: absolute; top: -12px">客户留言信息</b>
<div <div
v-for="(item, index) in detail.note" v-for="(item, index) in detail?.note"
:key="index" :key="index"
class="div-item" class="div-item"
> >
...@@ -493,68 +247,55 @@ ...@@ -493,68 +247,55 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="isJMPOD === 'POD'">
<div
class="detail-images"
v-if="detail && Object.keys(detail).length > 1"
>
<div class="scroll-list">
<div class="img-title">
<b>商品信息</b>
<div class="id">
<img src="@/assets/images/id.png" alt="" />
<span>{{ detail.variantSku.split('_')[0] }}</span>
</div>
</div>
<div class="scroll-content">
<div
class="scroll-item"
v-for="(it, i) in detail.colorImageList"
:key="i"
>
<el-image
style="width: 100%; height: 100%"
:src="it"
:preview-src-list="[it]"
></el-image>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import {
productionQueryApi,
getSubOrderBySubOrderNumber,
downloadMaterialApi,
} from '@/api/podOrder'
import { PodOrderRes, ImageItemInter } from '@/types/api/podOrder'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { ref, watch, defineProps, nextTick,defineEmits } from 'vue' import { filePath } from '@/api/axios'
interface DetailData { import { ref, watch, defineProps, nextTick, defineEmits } from 'vue'
imgList: Array<{ url: string; title: string; id: number }>
[key: string]: any
}
interface HistoryDataItem { interface HistoryDataItem {
orderNumber: string orderNumber: string
type: number type: number
finished: boolean finished: boolean
} }
const trackingNumberRef = ref(null) const trackingNumberRef = ref(null)
const shipForm = ref({ shipmentType: '1' }) // const shipForm = ref({ shipmentType: '1' })
const logistics = ref([]) // const logistics = ref([])
const historyData = ref<HistoryDataItem[]>([]) const historyData = ref<HistoryDataItem[]>([])
const placeholderText = ref('') const placeholderText = ref('')
const sendNum = ref(0) const sendNum = ref(0)
const isDownloadImage = ref(false) const isDownloadImage = ref(false)
const isAutoSure = ref(false) const isAutoSure = ref(false)
const detail = ref<DetailData>({ imgList: [] }) const detail = ref<PodOrderRes>({
id: -1,
podOrderId: -1,
imgList: [] as ImageItemInter[][],
})
const dialogVisible = ref(false) const dialogVisible = ref(false)
// 通过import动态导入音频文件
const audios = { const audios = {
weight_warning: '../../../assets/audio/weight_warning.mp3', weight_warning: new URL('@/assets/audio/weight_warning.mp3', import.meta.url)
weight_success: '../../../assets/audio/weight_success.mp3', .href,
weight_repeat: '../../../assets/audio/weight_repeat.mp3', weight_success: new URL('@/assets/audio/weight_success.mp3', import.meta.url)
weight_search_error: '../../../assets/audio/weight_search_error.mp3', .href,
weight_search_success: '../../../assets/audio/weight_search_success.mp3', weight_repeat: new URL('@/assets/audio/weight_repeat.mp3', import.meta.url)
} as const // 使用 as const 确保类型安全 .href,
weight_search_error: new URL(
'@/assets/audio/weight_search_error.mp3',
import.meta.url,
).href,
weight_search_success: new URL(
'@/assets/audio/weight_search_success.mp3',
import.meta.url,
).href,
}
const productInfo = ref({}) const productInfo = ref({})
const TrackingNumber = ref('') const TrackingNumber = ref('')
const props = defineProps({ const props = defineProps({
...@@ -578,29 +319,31 @@ const props = defineProps({ ...@@ -578,29 +319,31 @@ const props = defineProps({
default: null, default: null,
type: Object, type: Object,
}, },
isJMPOD: { isJmpod: {
default: 'POD', default: 'POD',
type: String, type: String,
}, },
}) })
const emit=defineEmits(['update:detailVisible', 'close']) const emit = defineEmits(['update:detailVisible', 'close'])
watch( watch(
() => props.detailVisible, () => props.detailVisible,
(newVal) => { (newVal: boolean) => {
dialogVisible.value = newVal dialogVisible.value = newVal
if (newVal) { if (newVal) {
const history = localStorage.getItem('historyData') const history = localStorage.getItem('historyData')
historyData.value = history ? JSON.parse(history) : [] historyData.value = history ? JSON.parse(history) : []
historyData.value.forEach((el) => { historyData.value.forEach((el: HistoryDataItem) => {
el.type = Number(el.type) el.type = Number(el.type)
}) })
const len = historyData.value.filter((el) => el.type === props.type) const len = historyData.value.filter(
(el: HistoryDataItem) => el.type === props.type,
)
if (len.length > 0) { if (len.length > 0) {
confirmQuery(len, 0) confirmQuery(len, 0)
} }
TrackingNumber.value = '' TrackingNumber.value = ''
isAutoSure.value = false isAutoSure.value = false
isDownloadImage.value = false
if (props.type === 1) { if (props.type === 1) {
placeholderText.value = placeholderText.value =
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产' '扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产'
...@@ -613,25 +356,22 @@ watch( ...@@ -613,25 +356,22 @@ watch(
// logistics.value = res.data[0].logisticsWayList // logistics.value = res.data[0].logisticsWayList
// }) // })
// shipForm.value = { shipmentType: '1' } // shipForm.value = { shipmentType: '1' }
// nextTick(() => { nextTick(() => {
// if (trackingNumberRef.value) { if (trackingNumberRef.value) {
// ;(trackingNumberRef.value as HTMLInputElement).focus() ;(trackingNumberRef.value as HTMLInputElement).focus()
// } }
// }) })
} }
}, },
) )
watch( watch(
() => props.detailData, () => props.detailData,
(newVal) => { (newVal) => {
console.log('this.detailData', newVal) // detail.value = {
detail.value = { // imgList: [],
imgList: [], // }
}
if (newVal && Object.keys(newVal).length > 0) { if (newVal && Object.keys(newVal).length > 0) {
const d = JSON.parse(JSON.stringify(newVal)) const d = JSON.parse(JSON.stringify(newVal))
if (d.note) { if (d.note) {
d.note = JSON.parse(d.note) d.note = JSON.parse(d.note)
} else { } else {
...@@ -650,8 +390,8 @@ watch( ...@@ -650,8 +390,8 @@ watch(
{ url: d.negativeImage, title: '反面', id: d.negativeDesignId }, { url: d.negativeImage, title: '反面', id: d.negativeDesignId },
]) ])
} }
arr = arr.filter((el) => el.url) arr = arr.filter((el: ImageItemInter) => el.url)
arr = arr.map((el) => { arr = arr.map((el: ImageItemInter) => {
return { return {
...el, ...el,
...{ ...{
...@@ -661,15 +401,15 @@ watch( ...@@ -661,15 +401,15 @@ watch(
}, },
} }
}) })
arr = arr.filter((el) => el.url) arr = arr.filter((el: ImageItemInter) => el.url)
const result = [] const result = []
for (let i = 0; i < arr.length; i += 2) { for (let i = 0; i < arr.length; i += 2) {
result.push(arr.slice(i, i + 2)) result.push(arr.slice(i, i + 2))
} }
d.imgList = result d.imgList = result as ImageItemInter[][]
console.log(d.imgList, 'this.detail.imgList ')
detail.value = d detail.value = d
} }
console.log(newVal, 'detail.value', detail.value)
}, },
{ deep: true }, { deep: true },
) )
...@@ -679,7 +419,6 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => { ...@@ -679,7 +419,6 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
`生产单号 ${el.orderNumber}${ `生产单号 ${el.orderNumber}${
el.type === 1 ? '生产完成' : '确定发货' el.type === 1 ? '生产完成' : '确定发货'
},取消则不提醒?`, },取消则不提醒?`,
'提示',
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -697,7 +436,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => { ...@@ -697,7 +436,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
}) })
.catch(() => { .catch(() => {
const index = historyData.value.findIndex( const index = historyData.value.findIndex(
(item) => (item: HistoryDataItem) =>
item.orderNumber === el.orderNumber && item.type === props.type, item.orderNumber === el.orderNumber && item.type === props.type,
) )
if (index >= 0) { if (index >= 0) {
...@@ -710,11 +449,11 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => { ...@@ -710,11 +449,11 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
}) })
} }
const changeStatus = () => { const changeStatus = async () => {
if (!detail.value || Object.keys(detail.value).length <= 1) { if (!detail.value || Object.keys(detail.value).length <= 1) {
return ElMessage.warning('请扫码生产单号') return ElMessage.warning('请扫码生产单号')
} }
showConfirm(`确定${props.type === 1 ? '生产完成' : '确定发货'}?`, '提示', { showConfirm(`确定${props.type === 1 ? '生产完成' : '确定发货'}?`, {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
...@@ -724,41 +463,17 @@ const changeStatus = () => { ...@@ -724,41 +463,17 @@ const changeStatus = () => {
} }
const setData = async (orderNumber: string) => { const setData = async (orderNumber: string) => {
if (detail.value && detail.value.id) { if (detail.value && detail.value?.id) {
let url
if (props.isJMPOD === 'JMPOD') {
url = 'pod/podJomallOrderProduct/completeDelivery'
} else {
url =
props.currentStatus == 'IN_PRODUCTION'
? 'pod/podProductionInfo/completeDelivery'
: 'pod/podProductionInfo/completeShipment'
}
try { try {
const data = const id = detail.value?.id
props.currentStatus == 'IN_PRODUCTION' await productionQueryApi(id)
? {
id: detail.value.id,
}
: {
list: [detail.value],
...shipForm.value,
}
if (data.list) {
data.list[0].note =
data.list[0].note && typeof data.list[0].note === 'object'
? JSON.stringify(data.list[0].note)
: null
}
// await post(url, data)
if (props.type === 2) { if (props.type === 2) {
sendNum.value = sendNum.value + 1 sendNum.value = sendNum.value + 1
} }
if (orderNumber) { if (orderNumber) {
const index = historyData.value.findIndex( const index = historyData.value.findIndex(
(el) => el.type === props.type && el.orderNumber === orderNumber, (el: HistoryDataItem) =>
el.type === props.type && el.orderNumber === orderNumber,
) )
if (index >= 0) { if (index >= 0) {
// 扫单完成删除 // 扫单完成删除
...@@ -768,10 +483,10 @@ const setData = async (orderNumber: string) => { ...@@ -768,10 +483,10 @@ const setData = async (orderNumber: string) => {
} }
playAudio('weight_success') playAudio('weight_success')
detail.value = { imgList: [] } detail.value = { id: -1, podOrderId: -1, imgList: [] }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
detail.value = { imgList: [] } detail.value = { id: -1, podOrderId: -1, imgList: [] }
playAudio('weight_search_error') playAudio('weight_search_error')
} }
} }
...@@ -781,72 +496,25 @@ const handleDownload = () => { ...@@ -781,72 +496,25 @@ const handleDownload = () => {
if (!detail.value || Object.keys(detail.value).length <= 1) { if (!detail.value || Object.keys(detail.value).length <= 1) {
return ElMessage.warning('请扫码生产单号') return ElMessage.warning('请扫码生产单号')
} }
if (props.isJMPOD === 'JMPOD') { download()
download()
} else {
downloadAllWe()
}
}
const download = () => {
// downloadFile('pod/podJomallOrderProduct/downloadByProduction', {
// subOrderNumberList: detail.value.subOrderNumber,
// method: 'POST',
// })
// .then((res) => {
// const { data, fileName } = res
// let url = window.URL.createObjectURL(data)
// let link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.download = fileName
// link.click()
// window.URL.revokeObjectURL(url)
// })
// .catch((err) => {
// console.log(err)
// })
} }
const download = async () => {
const downloadAllWe = (data?: number, designId?: number) => { try {
let params = { const id = detail.value.id
productionNo: detail.value.podProductionNo, if (id !== undefined) {
method: 'POST', const res = await downloadMaterialApi([id])
} const { data } = res
if (data === 1) { data.forEach((item: string) => {
params = { window.open(filePath + item)
...params, })
...{
designId,
},
}
} else if (data === 2) {
params = {
...params,
...{
negativeDesignId: designId,
},
} }
} catch (e) {
// showError(e)
console.error(e)
} }
// downloadFile('podDesignCenter/downloadByDesignId', params)
// .then((res) => {
// const { data, fileName } = res
// let url = window.URL.createObjectURL(data)
// // 生成一个a标签
// let link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// // 生成时间戳
// link.download = fileName
// link.click()
// window.URL.revokeObjectURL(url)
// })
// .catch((err) => {
// console.log(err)
// })
} }
type AudioKey = keyof typeof audios // 创建一个类型,确保 key 只能是 audios 对象的键之一
const playAudio = (key: string, message?: string) => { const playAudio = (key: AudioKey, message?: string) => {
let text = '' let text = ''
switch (key) { switch (key) {
case 'weight_search_success': case 'weight_search_success':
...@@ -866,20 +534,24 @@ const playAudio = (key: string, message?: string) => { ...@@ -866,20 +534,24 @@ const playAudio = (key: string, message?: string) => {
break break
} }
if (message || text) ElMessage.warning(message || text) if (message || text) ElMessage.warning(message || text)
let audio = document.createElement('audio') const audio = new Audio()
console.log(key) if (audios[key]) {
audio.src = audios[key] audio.src = audios[key] // 获取对应 key 的音频路径
audio.play() audio.play().catch((err) => console.error('Audio play failed:', err)) // 捕获音频播放失败的错误
} else {
console.error(`No audio found for key: ${key}`)
}
} }
const trackcodeInput = async () => { const trackcodeInput = async () => {
if (!TrackingNumber.value) { if (!TrackingNumber.value) {
ElMessage.warning('请扫描生产单号') // ElMessage.warning('请扫描生产单号')
playAudio('picking_warning') playAudio('weight_search_error')
return return
} }
const item = historyData.value.find( const item = historyData.value.find(
(el) => el.orderNumber === TrackingNumber.value && el.type === props.type, (el: HistoryDataItem) =>
el.orderNumber === TrackingNumber.value && el.type === props.type,
) )
if (!item) { if (!item) {
// 记录扫单 // 记录扫单
...@@ -900,17 +572,8 @@ const trackcodeInput = async () => { ...@@ -900,17 +572,8 @@ const trackcodeInput = async () => {
} else { } else {
await setData(orderNumber) await setData(orderNumber)
} }
let res
try { try {
const endpoint = const res = await getSubOrderBySubOrderNumber(orderNumber)
props.isJMPOD === 'JMPOD'
? 'pod/podJomallOrderProduct/findBySubOrderNumber'
: 'pod/podProductionInfo/findByPodProductionNo'
const params =
props.isJMPOD === 'JMPOD'
? { subOrderNumber: orderNumber }
: { podProductionNo: orderNumber, status: props.currentStatus }
res = await get(endpoint, params)
const d = JSON.parse(JSON.stringify(res.data)) const d = JSON.parse(JSON.stringify(res.data))
if (d.note) { if (d.note) {
d.note = JSON.parse(d.note) d.note = JSON.parse(d.note)
...@@ -930,9 +593,8 @@ const trackcodeInput = async () => { ...@@ -930,9 +593,8 @@ const trackcodeInput = async () => {
]) ])
} }
const result = [] const result = []
console.log(arr) arr = arr.filter((el: ImageItemInter) => el.url)
arr = arr.filter((el) => el.url) arr = arr.map((el: ImageItemInter) => {
arr = arr.map((el) => {
return { return {
...el, ...el,
...{ ...{
...@@ -947,18 +609,13 @@ const trackcodeInput = async () => { ...@@ -947,18 +609,13 @@ const trackcodeInput = async () => {
result.push(arr.slice(i, i + 2)) result.push(arr.slice(i, i + 2))
} }
d.imgList = result d.imgList = result
console.log(d.imgList, 'this.detail.imgList ')
detail.value = d detail.value = d
if (detail.value.importFactory) { if (detail.value?.importFactory) {
ElMessage.warning('只支持自有工厂的订单') ElMessage.warning('只支持自有工厂的订单')
return return
} }
if (isDownloadImage.value) { if (isDownloadImage.value) {
if (props.isJMPOD === 'JMPOD') { download()
download()
} else {
downloadAllWe()
}
} }
playAudio('weight_search_success') playAudio('weight_search_success')
nextTick(() => { nextTick(() => {
......
...@@ -203,26 +203,26 @@ export default function useShipment(callback?: () => void) { ...@@ -203,26 +203,26 @@ export default function useShipment(callback?: () => void) {
try { try {
const res = await saveOrder(data, shipmentForm.value) const res = await saveOrder(data, shipmentForm.value)
fetch(res.message || '') fetch(res.message || '')
.then((response) => { // .then((response) => {
// 确保响应是 OK // // 确保响应是 OK
if (!response.ok) { // if (!response.ok) {
throw new Error('网络响应错误') // throw new Error('网络响应错误')
} // }
// 返回图片的二进制数据(Blob) // // 返回图片的二进制数据(Blob)
return response.blob() // return response.blob()
}) // })
.then((blob) => { // .then((blob) => {
const a = document.createElement('a') // const a = document.createElement('a')
a.href = window.URL.createObjectURL(blob) // a.href = window.URL.createObjectURL(blob)
a.target = '_blank' // a.target = '_blank'
a.download = (res.message as string).split('/')[ // a.download = (res.message as string).split('/')[
(res.message as string).split('/').length - 1 // (res.message as string).split('/').length - 1
] // ]
a.click() // a.click()
}) // })
.catch((error) => { // .catch((error) => {
console.error('下载图片时出错:', error) // console.error('下载图片时出错:', error)
}) // })
ElMessage.success('发货成功') ElMessage.success('发货成功')
shipmentVisible.value = false shipmentVisible.value = false
callback && callback() callback && callback()
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</div> </div>
</div> </div>
<div class="order-content flex-1 flex-column overflow-hidden mt-10"> <div class="order-content flex-1 flex-column overflow-hidden mt-10">
<div class="order-operate-btn"> <div style="margin-bottom: 10px">
<span v-if="status === 'TO_BE_CONFIRMED'" class="item"> <span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="success" @click="confirmProduce">确认生产</ElButton> <ElButton type="success" @click="confirmProduce">确认生产</ElButton>
</span> </span>
...@@ -131,10 +131,7 @@ ...@@ -131,10 +131,7 @@
>打印生产单</ElButton >打印生产单</ElButton
> >
</span> </span>
<span <span v-if="status === 'TO_BE_CONFIRMED'" class="item">
v-if="status === 'TO_BE_CONFIRMED' || status === 'IN_PRODUCTION'"
class="item"
>
<ElButton type="success" dark @click="exportManuscript" <ElButton type="success" dark @click="exportManuscript"
>导出生产单</ElButton >导出生产单</ElButton
> >
...@@ -156,7 +153,7 @@ ...@@ -156,7 +153,7 @@
下载素材</ElButton 下载素材</ElButton
> >
</span> </span>
<span <!-- <span
v-if=" v-if="
['TO_BE_CONFIRMED', 'IN_PRODUCTION', 'PART_SHIPPING'].includes( ['TO_BE_CONFIRMED', 'IN_PRODUCTION', 'PART_SHIPPING'].includes(
status, status,
...@@ -167,18 +164,21 @@ ...@@ -167,18 +164,21 @@
<ElButton type="primary" @click="refreshProduct" <ElButton type="primary" @click="refreshProduct"
>刷新商品信息</ElButton >刷新商品信息</ElButton
> >
</span> </span> -->
<span <span
v-if="status === 'IN_PRODUCTION' || status === 'PART_SHIPPING'" v-if="status === 'WAIT_SHIPMENT' || status === 'PART_SHIPPING'"
class="item" class="item"
> >
<ElButton type="success" @click="confirmDelivery">发货</ElButton> <ElButton type="success" @click="confirmDelivery">发货</ElButton>
</span> </span>
<span v-if="status === 'IN_PRODUCTION'" class="item"> <!-- <span v-if="status === 'IN_PRODUCTION'" class="item">
<ElButton type="danger" @click="voidedBtn">作废</ElButton> <ElButton type="danger" @click="voidedBtn">作废</ElButton>
</span> </span> -->
</div> </div>
<div v-if="status == 'IN_PRODUCTION'" class="card-mode"> <div
v-if="['IN_PRODUCTION', 'WAIT_SHIPMENT'].includes(status)"
class="card-mode"
>
<div v-loading="loading" class="card-list"> <div v-loading="loading" class="card-list">
<div <div
v-for="cardItem in CardOrderList" v-for="cardItem in CardOrderList"
...@@ -190,26 +190,29 @@ ...@@ -190,26 +190,29 @@
:card-item="cardItem" :card-item="cardItem"
:class="{ active: isSelectStatused(cardItem) }" :class="{ active: isSelectStatused(cardItem) }"
> >
<template #top_right> 工厂类型 </template> <!-- <template #top_right> 工厂类型 </template> -->
<template #bottom_left> <template #bottom_left>
<span <span
v-if="cardItem.thirdSubOrderNumber" v-if="cardItem?.factorySubOrderNumber"
title="生产单号" title="生产单号"
class="base_sku" class="base_sku"
@click.stop="copy(cardItem.thirdSubOrderNumber, '生产单号')" @click.stop="copy(cardItem?.factorySubOrderNumber)"
> >
{{ cardItem.thirdSubOrderNumber }} {{ cardItem?.factorySubOrderNumber }}
</span> </span>
</template> </template>
<template #operations> <template #operations>
<Icon name="caozuorizhi" @click.stop="operationLog(cardItem)"> <Icon
name="caozuorizhi"
@click.stop="openLog(cardItem.podOrderId)"
>
<template #title> <template #title>
<title>操作日志</title> <title>操作日志</title>
</template> </template>
</Icon> </Icon>
<Icon <Icon
name="chakanxiangqing" name="chakanxiangqing"
@click.stop="submitReview(cardItem, true)" @click.stop="openDetail(cardItem.id)"
> >
<template #title> <template #title>
<title>查看详情</title> <title>查看详情</title>
...@@ -241,29 +244,32 @@ ...@@ -241,29 +244,32 @@
</div> </div>
</div> </div>
<b <b
v-if="cardItem"
:style="{ :style="{
color: color:
cardItem.customizedQuantity > 1 ? 'red' : '#67C23A', (cardItem.customizedQuantity || 0) > 1
? 'red'
: '#67C23A',
}" }"
> >
{{ cardItem.customizedQuantity > 1 ? '多' : '单' }} {{ (cardItem.customizedQuantity || 0) > 1 ? '多' : '单' }}
</b> </b>
</div> </div>
</template> </template>
<template #info> <template #info>
<div <div
style="height: 110px; font-size: 12px; padding: 10px 5px 0" style="height: 100px; font-size: 12px; padding: 14px 5px 0"
> >
<el-row class="el_row"> <el-row class="el_row">
<el-col :span="14" :offset="0"> <el-col :span="14" :offset="0">
<el-tooltip <el-tooltip
class="item" class="item"
effect="dark" effect="dark"
:content="cardItem.baseSku" :content="cardItem?.baseSku"
placement="bottom" placement="bottom"
> >
<span <span
title="基版" title="Base SKU"
style=" style="
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
...@@ -272,7 +278,7 @@ ...@@ -272,7 +278,7 @@
display: inline-block; display: inline-block;
" "
> >
{{ cardItem.baseSku }} {{ cardItem?.baseSku }}
</span> </span>
</el-tooltip> </el-tooltip>
</el-col> </el-col>
...@@ -280,38 +286,54 @@ ...@@ -280,38 +286,54 @@
<el-tooltip <el-tooltip
class="item" class="item"
effect="dark" effect="dark"
:content="'数量'" :content="
status === 'IN_PRODUCTION'
? '未生产数量'
: '已生产数量'
"
placement="bottom" placement="bottom"
> >
<span>数量:{{ cardItem.num }}</span> <span
>数量:{{
status === 'IN_PRODUCTION'
? cardItem?.notPassNum
: cardItem?.passNum
}}</span
>
</el-tooltip> </el-tooltip>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row style="margin-top: 5px">
<el-col :span="14" :offset="0" style="white-space: nowrap"> <el-col
<span>货号:</span> :span="14"
:offset="0"
style="
white-space: nowrap;
display: flex;
align-items: center;
"
>
<span <span
:title="cardItem.supplierItemNo" title="Variant SKU"
style=" style="
display: inline-block; display: inline-block;
width: calc(100% - 38px); width: 100%;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: bottom;
" "
> >
{{ cardItem.supplierItemNo || '--' }} {{ cardItem?.variantSku }}
</span> </span>
</el-col> </el-col>
<el-col <el-col :span="10" :offset="0" style="text-align: right">
:span="10" <el-tooltip
:offset="0" class="item"
style="text-align: right; white-space: nowrap" effect="dark"
> :content="'货号'"
<span>工厂:</span> placement="bottom"
<span>{{ >
cardItem.factoryCode || cardItem.supplierCode <span>货号:{{ cardItem?.supplierItemNo }}</span>
}}</span> </el-tooltip>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 5px"> <el-row style="margin-top: 5px">
...@@ -326,7 +348,7 @@ ...@@ -326,7 +348,7 @@
> >
<span>工艺:</span> <span>工艺:</span>
<span <span
:title="cardItem.process" :title="String(cardItem?.process)"
style=" style="
display: inline-block; display: inline-block;
width: 100%; width: 100%;
...@@ -334,19 +356,19 @@ ...@@ -334,19 +356,19 @@
text-overflow: ellipsis; text-overflow: ellipsis;
" "
> >
{{ cardItem.process }} {{ cardItem?.process }}
</span> </span>
</el-col> </el-col>
<el-col :span="12" :offset="0" style="text-align: right"> <el-col :span="12" :offset="0" style="text-align: right">
<span title="期望交货时间"> <span title="期望交货时间">
{{ cardItem.expectDeliveryTime }} {{ cardItem?.expectDeliveryTime }}
</span> </span>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 5px"> <el-row style="margin-top: 5px">
<el-col :span="14" :offset="0" style="white-space: nowrap"> <el-col :span="14" :offset="0" style="white-space: nowrap">
<span <span
:title="`店铺单号:${cardItem.shopNumber}`" :title="`店铺单号:${cardItem?.shopNumber}`"
style=" style="
display: inline-block; display: inline-block;
width: 100%; width: 100%;
...@@ -354,36 +376,10 @@ ...@@ -354,36 +376,10 @@
text-overflow: ellipsis; text-overflow: ellipsis;
" "
> >
{{ cardItem.shopNumber }} {{ cardItem?.shopNumber }}
</span>
</el-col>
<el-col :span="10" :offset="0" style="text-align: right">
<span
title="延期小时数"
style="font-weight: bold; font-size: 16px"
:style="setFontColor(cardItem.delay || 0)"
>
{{ `${cardItem.delay || 0}小时` }}
</span> </span>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="13" :offset="0">
<a href="javascript:void(0)" style="color: blue">
<img src="@/assets/images/id.png" height="20" alt="" />
<el-tooltip
class="item"
effect="dark"
:content="String(cardItem.id)"
placement="top"
>
<span title="素材ID" style="vertical-align: super">
{{ cardItem.id }}
</span>
</el-tooltip>
</a>
</el-col>
</el-row>
</div> </div>
</template> </template>
</CardWrapper> </CardWrapper>
...@@ -397,7 +393,6 @@ ...@@ -397,7 +393,6 @@
element-loading-text="加载中..." element-loading-text="加载中..."
class="order-list flex-1 overflow-hidden" class="order-list flex-1 overflow-hidden"
> >
{{ thOrderDetailWidth }}
<TableView <TableView
:paginated-data="tableData" :paginated-data="tableData"
:columns="tableColumns" :columns="tableColumns"
...@@ -722,16 +717,17 @@ ...@@ -722,16 +717,17 @@
<LogList :log-list="logList" /> <LogList :log-list="logList" />
</el-dialog> </el-dialog>
<fastProduction <fastProduction
v-model:detailVisible="detailVisible"
:title="fastTitle" :title="fastTitle"
:isJMPOD="'JMPOD'" :is-jmpod="'JMPOD'"
:type="fastType" :type="fastType"
:detailData="detailData" :detail-data="detailData"
v-model="detailVisible" :current-status="status"
:currentStatus="currentStatus"
@close="fastClose" @close="fastClose"
></fastProduction> ></fastProduction>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
// refreshJMProductInfo,reasonInvalidationApi,
import { import {
getOrderTabData, getOrderTabData,
getOrderList, getOrderList,
...@@ -743,18 +739,15 @@ import { ...@@ -743,18 +739,15 @@ import {
exportOrder, exportOrder,
getLogList, getLogList,
updateRemarkApi, updateRemarkApi,
refreshJMProductInfo,
reasonInvalidationApi,
getCardOrderList, getCardOrderList,
getOrderDetail,
} from '@/api/podOrder' } from '@/api/podOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
OrderData, // OrderData,
ProductList, // ProductList,
LogisticsData, LogisticsData,
ShipmentForm, ShipmentForm,
CardOrderItem,
cardImages,
} from '@/types/api/order' } from '@/types/api/order'
import fastProduction from '../fastProduction.vue' import fastProduction from '../fastProduction.vue'
import CardWrapper from '@/components/CardPods.vue' import CardWrapper from '@/components/CardPods.vue'
...@@ -768,13 +761,20 @@ import ProductInfo from '../ProductInfo.vue' ...@@ -768,13 +761,20 @@ import ProductInfo from '../ProductInfo.vue'
import { SpanMethodProps } from '@/types/api/order' import { SpanMethodProps } from '@/types/api/order'
import useShipment from '../hook/podUseShipMent' import useShipment from '../hook/podUseShipMent'
import Shipment from '../Shipment.vue' import Shipment from '../Shipment.vue'
import { SearchForm, Tab, LogListData } from '@/types/api/podOrder' import {
SearchForm,
Tab,
LogListData,
PodProductList,
cardImages,
imageAryInter,
CardOrderData,
} from '@/types/api/podOrder'
import { getLogisticsCompanyList } from '@/api/common' import { getLogisticsCompanyList } from '@/api/common'
import { ElButton, type FormRules } from 'element-plus' import { ElButton, type FormRules } from 'element-plus'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import LogList from '@/components/LogList.vue' import LogList from '@/components/LogList.vue'
// 日期工具函数 // 日期工具函数
const getDateRange = (days = 0, type: 'past' | 'future' = 'past') => { const getDateRange = (days = 0, type: 'past' | 'future' = 'past') => {
const end = dayjs() const end = dayjs()
...@@ -857,7 +857,24 @@ const loadTabData = async () => { ...@@ -857,7 +857,24 @@ const loadTabData = async () => {
// showError(error) // showError(error)
} }
} }
const CardOrderList = ref<CardOrderItem[]>([]) // 查看详情
const openDetail = async (id: number) => {
try {
const res = await getOrderDetail(id)
if (res.code == 200) {
if (res.data.imageAry) {
res.data.imageAry = JSON.parse(res.data.imageAry as string)
}
detailData.value = res.data || {}
detailVisible.value = true
fastTitle.value = '查看详情'
fastType.value = 0
}
} catch (e) {
//showError(e)
}
}
const CardOrderList = ref<PodProductList[]>([])
const loadCardList = async () => { const loadCardList = async () => {
try { try {
const res = await getCardOrderList( const res = await getCardOrderList(
...@@ -877,17 +894,17 @@ const loadCardList = async () => { ...@@ -877,17 +894,17 @@ const loadCardList = async () => {
currentPage.value, currentPage.value,
pageSize.value, pageSize.value,
) )
CardOrderList.value = res.data.records.map((item: CardOrderItem) => { CardOrderList.value = res.data.records.map((item) => {
if (!item.imageAry) { if (!item.imageAry) {
const images = [] const images = []
if (item.variantImage) { if (typeof item.variantImage === 'string') {
images.push({ images.push({
ename: 'front', ename: 'front',
cname: '正面', cname: '正面',
image: item.variantImage, image: item.variantImage,
}) })
} }
if (item.negativeImage) { if (typeof item.negativeImage === 'string') {
images.push({ images.push({
ename: 'back', ename: 'back',
cname: '反面', cname: '反面',
...@@ -897,25 +914,28 @@ const loadCardList = async () => { ...@@ -897,25 +914,28 @@ const loadCardList = async () => {
item.images = images item.images = images
} else { } else {
if (item.imageAry) { if (item.imageAry) {
const images = JSON.parse(item.imageAry) const images = JSON.parse(item.imageAry as string)
item.images = images.map((e) => { if (Array.isArray(images)) {
return { item.images = images.map((e: imageAryInter) => {
ename: '', return {
cname: '', ename: '',
image: e.url, cname: '',
} image: e.url,
}) }
})
}
} }
} }
return item return item
}) })
total.value = res.data.total
} catch (error) { } catch (error) {
// showError(error) // showError(error)
} }
} }
const currentImage = ref('') const currentImage = ref('')
const currentId = ref(undefined) const currentId = ref(-1)
const changeImages = (item: cardImages, data: CardOrderItem) => { const changeImages = (item: cardImages, data: PodProductList) => {
currentImage.value = item.image currentImage.value = item.image
// data.designId = item.designId // data.designId = item.designId
currentId.value = data.id currentId.value = data.id
...@@ -927,38 +947,41 @@ const changeImages = (item: cardImages, data: CardOrderItem) => { ...@@ -927,38 +947,41 @@ const changeImages = (item: cardImages, data: CardOrderItem) => {
const fastTitle = ref('') const fastTitle = ref('')
const detailData = ref({}) const detailData = ref({})
const detailVisible = ref(false) const detailVisible = ref(false)
const fastType = ref<null | number>(null) const fastType = ref<number>(-1)
const fastToProduction = (title: string, type: number) => { const fastToProduction = (title: string, type: number) => {
detailData.value = {} detailData.value = {}
detailVisible.value = true detailVisible.value = true
fastTitle.value = title fastTitle.value = title
fastType.value = type fastType.value = type
} }
const cardClick = (data: CardOrderItem) => { const cardClick = (data: PodProductList) => {
const status = isSelectStatused(data) const status = isSelectStatused(data)
if (status) { if (status) {
selection.value = selection.value.filter( selection.value = selection.value.filter((item) => item.id !== data.id)
(item: CardOrderItem) => item.id !== data.id,
)
} else { } else {
selection.value.push(data) selection.value.push(data)
} }
} }
const isSelectStatused = (data: CardOrderItem) => { const isSelectStatused = (data: PodProductList) => {
const index = selection.value.findIndex( const index = selection.value.findIndex((item) => item.id === data.id)
(item: CardOrderItem) => item.id === data.id,
)
return index !== -1 return index !== -1
} }
const changeTab = (item: Tab) => { const changeTab = (item: Tab) => {
status.value = item.status ?? '' status.value = item.status ?? ''
selection.value = []
searchForm.value.timeType = null searchForm.value.timeType = null
loading.value = false loading.value = false
loadDiffList() loadDiffList()
} }
const fastClose = () => {
if (fastType.value !== 0) {
loadTabData()
}
detailVisible.value = false
}
// 根据不同状态调用不同接口 // 根据不同状态调用不同接口
const loadDiffList = () => { const loadDiffList = () => {
if (status.value === 'IN_PRODUCTION') { if (['IN_PRODUCTION', 'WAIT_SHIPMENT'].includes(status.value)) {
loadCardList() loadCardList()
} else { } else {
search() search()
...@@ -970,7 +993,7 @@ const [searchForm] = useValue<SearchForm>({ ...@@ -970,7 +993,7 @@ const [searchForm] = useValue<SearchForm>({
shopNumber: '', shopNumber: '',
order: 'desc', order: 'desc',
}) })
const tableColumns = computed<CustomColumn<OrderData[]>>(() => { const tableColumns = computed<CustomColumn<CardOrderData[]>>(() => {
return [ return [
{ {
type: 'selection', type: 'selection',
...@@ -1045,7 +1068,7 @@ const { ...@@ -1045,7 +1068,7 @@ const {
status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList
return fetchData(commonParams, page, pageSize).then((res) => { return fetchData(commonParams, page, pageSize).then((res) => {
// if (status.value === 'IN_PRODUCTION') { // if (status.value === 'IN_PRODUCTION') {
// const cardList = res.data.records.map((item: CardOrderItem) => { // const cardList = res.data.records.map((item: PodProductList) => {
// if (!item.imageAry) { // if (!item.imageAry) {
// const images = [] // const images = []
// if (item.variantImage) { // if (item.variantImage) {
...@@ -1139,50 +1162,42 @@ const getLogisticsList = async () => { ...@@ -1139,50 +1162,42 @@ const getLogisticsList = async () => {
//showError(error) //showError(error)
} }
} }
const setFontColor = (day: number) => { // const refreshProduct = async () => {
if (day >= 0 && day <= 5) { // if (selection.value.length === 0) {
return 'color: green' // return ElMessage({
} else if (day > 5 && day <= 15) { // message: '请选择订单',
return 'color: orange' // type: 'warning',
} else { // offset: window.innerHeight / 2,
return 'color: red' // })
} // }
} // try {
const refreshProduct = async () => { // await showConfirm('是否刷新商品信息', {
if (selection.value.length === 0) { // confirmButtonText: '确认',
return ElMessage({ // cancelButtonText: '取消',
message: '请选择订单', // type: 'warning',
type: 'warning', // })
offset: window.innerHeight / 2, // } catch {
}) // return
} // }
try { // try {
await showConfirm('是否刷新商品信息', { // const res = await refreshJMProductInfo(selection.value.map((el) => el.id))
confirmButtonText: '确认', // ElMessage({
cancelButtonText: '取消', // message: res.message,
type: 'warning', // type: 'success',
}) // offset: window.innerHeight / 2,
} catch { // })
return // loadTabData()
} // loadDiffList()
try { // } catch (e) {
const res = await refreshJMProductInfo(selection.value.map((el) => el.id)) // // showError(e)
ElMessage({ // }
message: res.message, // }
type: 'success', const openAll = (row: CardOrderData) => {
offset: window.innerHeight / 2,
})
loadTabData()
loadDiffList()
} catch (e) {
// showError(e)
}
}
const openAll = (row: OrderData) => {
row.moreable = !row.moreable row.moreable = !row.moreable
} }
const selection = ref<OrderData[]>([]) // 表格和卡片的选中值:有两种约束
const handleSelectionChange = (s: OrderData[]) => { const selection = ref<CardOrderData[] | PodProductList[]>([])
const handleSelectionChange = (s: CardOrderData[]) => {
selection.value = s selection.value = s
} }
// 确认生产 // 确认生产
...@@ -1222,10 +1237,18 @@ const downloadMaterial = async () => { ...@@ -1222,10 +1237,18 @@ const downloadMaterial = async () => {
offset: window.innerHeight / 2, offset: window.innerHeight / 2,
}) })
} }
try { const ids = []
const res = await downloadMaterialApi( if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') {
selection.value.map((item) => item.id), ids.push(...selection.value.map((item) => item.id))
} else {
ids.push(
...selection.value.flatMap(
(item) => item.productList?.map((sub:PodProductList) => sub.id) || [],
),
) )
}
try {
const res = await downloadMaterialApi(ids)
const { data } = res const { data } = res
data.forEach((item: string) => { data.forEach((item: string) => {
window.open(filePath + item) window.open(filePath + item)
...@@ -1257,7 +1280,7 @@ const copy = (text: string): void => { ...@@ -1257,7 +1280,7 @@ const copy = (text: string): void => {
} }
document.body.removeChild(oInput) document.body.removeChild(oInput)
} }
const onChangeCurrentRow = (item: ProductList) => { const onChangeCurrentRow = (item) => {
currentRow.value = item currentRow.value = item
} }
const cancelOrder = async (id: number) => { const cancelOrder = async (id: number) => {
...@@ -1313,34 +1336,34 @@ const addInternalTag = async () => { ...@@ -1313,34 +1336,34 @@ const addInternalTag = async () => {
} }
}) })
} }
const voidedBtn = async () => { // const voidedBtn = async () => {
if (selection.value.length === 0) { // if (selection.value.length === 0) {
return ElMessage({ // return ElMessage({
message: '请选择订单', // message: '请选择订单',
type: 'warning', // type: 'warning',
offset: window.innerHeight / 2, // offset: window.innerHeight / 2,
}) // })
} // }
ElMessageBox.prompt('', '作废', { // ElMessageBox.prompt('', '作废', {
confirmButtonText: '确认', // confirmButtonText: '确认',
cancelButtonText: '取消', // cancelButtonText: '取消',
inputPlaceholder: '请输入作废原因', // inputPlaceholder: '请输入作废原因',
inputPattern: /.+/, // inputPattern: /.+/,
inputErrorMessage: '作废原因不能为空', // inputErrorMessage: '作废原因不能为空',
}).then(async ({ value }) => { // }).then(async ({ value }) => {
try { // try {
const res = await reasonInvalidationApi( // const res = await reasonInvalidationApi(
selection.value.map((item) => item.id), // selection.value.map((item) => item.id),
value, // value,
) // )
ElMessage.success(res.message) // ElMessage.success(res.message)
loadTabData() // loadTabData()
loadDiffList() // loadDiffList()
} catch (e) { // } catch (e) {
// showError(e) // // showError(e)
} // }
}) // })
} // }
const printManuscript = async () => { const printManuscript = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage({ return ElMessage({
...@@ -1349,8 +1372,16 @@ const printManuscript = async () => { ...@@ -1349,8 +1372,16 @@ const printManuscript = async () => {
offset: window.innerHeight / 2, offset: window.innerHeight / 2,
}) })
} }
const ids = []
const ids = selection.value.map((item) => item.id) if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') {
ids.push(...selection.value.map((item) => item.id))
} else {
ids.push(
...selection.value.flatMap(
(item) => item.productList?.map((sub:PodProductList) => sub.id) || [],
),
)
}
try { try {
await showConfirm('是否打印生产单', { await showConfirm('是否打印生产单', {
confirmButtonText: '确认', confirmButtonText: '确认',
...@@ -1674,7 +1705,13 @@ onMounted(() => { ...@@ -1674,7 +1705,13 @@ onMounted(() => {
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
.order-detail_goods-info--content {
padding: 10px 0;
font-size: 14px;
:deep(.order-list-expand_item) {
padding: 10px 0;
}
}
.order-list-expand_item_info_title { .order-list-expand_item_info_title {
line-height: 26px; line-height: 26px;
display: flex; display: flex;
......
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