Commit aeb4f4a5 by wuqian

生产中优化

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