Commit 0704a9ce by wuqian

快捷生产+生产中卡片

parent 7ceb2a04
...@@ -221,7 +221,6 @@ export function refreshProductInfo(data: number[]) { ...@@ -221,7 +221,6 @@ export function refreshProductInfo(data: number[]) {
data, data,
) )
} }
export function getDeliveryNoteList( export function getDeliveryNoteList(
data: DeliveryNoteSearchForm, data: DeliveryNoteSearchForm,
currentPage: number, currentPage: number,
......
...@@ -15,13 +15,29 @@ export function getOrderTabData() { ...@@ -15,13 +15,29 @@ export function getOrderTabData() {
'factory/podJomallOrder/findStateGroupList', 'factory/podJomallOrder/findStateGroupList',
) )
} }
export function refreshJMProductInfo(data: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrder/refreshJomallPodProduct ',
data,
)
}
export function getOrderList( export function getOrderList(
data: SearchForm, data: SearchForm,
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
) { ) {
return axios.post<never, BasePaginationData<OrderData>>( return axios.post<never, BasePaginationData<OrderData>>(
'/factory/podJomallOrder/list_page ', '/factory/podJomallOrder/list_page',
{ ...data, currentPage, pageSize },
)
}
export function getCardOrderList(
data: SearchForm,
currentPage: number,
pageSize: number,
) {
return axios.post<never, BasePaginationData<OrderData>>(
'/factory/podJomallOrder/getSubListPage',
{ ...data, currentPage, pageSize }, { ...data, currentPage, pageSize },
) )
} }
...@@ -75,6 +91,12 @@ export function addInternalTagApi(idList: number[], memo: string) { ...@@ -75,6 +91,12 @@ export function addInternalTagApi(idList: number[], memo: string) {
{ idList, content: memo }, { idList, content: memo },
) )
} }
export function reasonInvalidationApi(idList: number[], memo: string) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrder/invalidSubOrder',
{ idList, reasonStr: memo },
)
}
// 打印生产单 // 打印生产单
export function printOrder(ids: number[]) { export function printOrder(ids: number[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
......
<template>
<div class="commodity-card">
<div class="commodity-card-image">
<div class="before"></div>
<div class="image">
<img :src="cardItem.variantImage" />
</div>
<div class="img_top_left">
<span class="select-icon"></span>
</div>
<div class="img_top_right">
<slot name="top_right"></slot>
</div>
<div class="img_bottom_left">
<slot name="bottom_left"></slot>
</div>
<div class="img_bottom_right">
<slot name="operations"></slot>
</div>
</div>
<div class="commodity-card-info">
<slot name="images"></slot>
<slot name="info"></slot>
</div>
</div>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import type { TypesettingListData } from '../types/api/typesetting'
defineProps({
cardItem: {
type: Object as PropType<TypesettingListData>,
required: true,
},
})
const copy = (text: string) => {
navigator.clipboard.writeText(text)
ElMessage.success('复制成功')
}
</script>
<style lang="scss" scoped>
.commodity-card-image {
position: relative;
.img_top_left {
position: absolute;
top: 5px;
left: 5px;
}
.img_top_right {
position: absolute;
top: 5px;
right: 5px;
}
.img_bottom_left {
position: absolute;
bottom: 2px;
left: 5px;
}
.img_bottom_right {
position: absolute;
bottom: 5px;
right: 5px;
:deep(.svg-icon) {
width: 2em;
height: 2em;
}
}
}
.before {
height: 0;
padding-top: 120%;
}
.image {
position: absolute;
inset: 0;
img {
width: 100%;
height: 100%;
object-fit: contain;
object-position: center;
}
}
.color-image {
.color-image-item {
width: 50px;
height: 50px;
}
img {
width: 100%;
height: 100%;
}
}
.commodity-card-info {
padding: 10px;
font-size: 14px;
background: linear-gradient(
90deg,
rgba(228, 228, 228, 0.4) 0%,
rgba(255, 255, 255, 1) 100%
);
}
.commodity-card-name-price {
height: 30px;
line-height: 30px;
}
.commodity-card-sku {
display: flex;
align-items: center;
gap: 5px;
background-color: #fff;
}
.select-icon {
position: relative;
display: block;
width: 16px;
height: 16px;
border: 1px solid #cccccc;
box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.4) inset;
border-radius: 8px;
background: #fff;
}
.commodity-card.active .select-icon {
background: #4168ff;
position: relative;
border-color: #4168ff;
box-shadow: none;
font-size: 18px;
top: -1px;
left: -1px;
}
.commodity-card.active .select-icon::after {
position: absolute;
content: '';
top: 0px;
left: 4px;
width: 4px;
height: 8px;
border-width: 2px;
border-style: solid;
border-color: transparent #fff #fff transparent;
transform: rotate(45deg) scale(0.8);
}
</style>
...@@ -72,7 +72,38 @@ export interface OrderData { ...@@ -72,7 +72,38 @@ 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
......
...@@ -4,10 +4,11 @@ import { debounce } from 'lodash-es' ...@@ -4,10 +4,11 @@ import { debounce } from 'lodash-es'
export default function useElTableColumnWidth( export default function useElTableColumnWidth(
selector: string, selector: string,
): [Ref<HTMLElement | null>, Ref<number>] { ): [Ref<HTMLElement | null>, Ref<number>, () => void] {
// 返回值:元祖里添加第三个参数,实现二次渲染
const tableWrapperRef = ref<HTMLDivElement | null>(null) const tableWrapperRef = ref<HTMLDivElement | null>(null)
const width = ref(0) const width = ref(0)
// 清理事件监听器
let cleanupResizeEventListener: (() => void) | undefined let cleanupResizeEventListener: (() => void) | undefined
let cleanupThResizeEventListener: (() => void) | undefined let cleanupThResizeEventListener: (() => void) | undefined
...@@ -15,6 +16,7 @@ export default function useElTableColumnWidth( ...@@ -15,6 +16,7 @@ export default function useElTableColumnWidth(
const onThResize = () => { const onThResize = () => {
if (currentTh) width.value = currentTh.offsetWidth if (currentTh) width.value = currentTh.offsetWidth
} }
// 监听目标列大小变化
const watchThSizeChange = (th: HTMLElement) => { const watchThSizeChange = (th: HTMLElement) => {
if (currentTh === th) return if (currentTh === th) return
currentTh = th currentTh = th
...@@ -25,7 +27,11 @@ export default function useElTableColumnWidth( ...@@ -25,7 +27,11 @@ export default function useElTableColumnWidth(
currentTh = null currentTh = null
} }
} }
// 手动触发列宽更新
const updateColumnWidth = () => {
onTableWrapperResize()
}
// 表格容器大小变化监听
const onTableWrapperResize = debounce(() => { const onTableWrapperResize = debounce(() => {
const el = tableWrapperRef.value const el = tableWrapperRef.value
if (!el) return if (!el) return
...@@ -50,5 +56,5 @@ export default function useElTableColumnWidth( ...@@ -50,5 +56,5 @@ export default function useElTableColumnWidth(
cleanupThResizeEventListener?.() cleanupThResizeEventListener?.()
}) })
return [tableWrapperRef, width] return [tableWrapperRef, width, updateColumnWidth]
} }
...@@ -170,6 +170,18 @@ ...@@ -170,6 +170,18 @@
(item.num || 0) - ((item.shipmentNum || 0) - (item.notPassNum || 0)) (item.num || 0) - ((item.shipmentNum || 0) - (item.notPassNum || 0))
}}</span> }}</span>
</div> </div>
<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 || '--'
}}</span>
</div>
<div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">工艺简称:</span>
<span class="order-list-expand_item_value">{{
item.process || '--'
}}</span>
</div>
<div v-if="!isPod" 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">{{
......
<template>
<el-dialog
:title="title"
:visible.sync="dialogVisible"
top="140px"
:fullscreen="true"
@close="emit('close')"
:close-on-click-modal="false"
>
<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"
style="height: 100%"
:autoplay="false"
indicator-position="none"
>
<el-carousel-item
style="height: 100%"
:key="index"
v-for="(item, index) in detail.imgList"
>
<el-row :gutter="10" style="width: 100%; height: 100%">
<el-col
style="height: 100%"
v-for="(it, i) in item"
:key="i"
:span="12"
>
<div class="left-image">
<b v-show="it.title && it.url">
{{ it.title }}
<span
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 }}
</span>
</b>
<img :src="it.url" alt="" />
</div>
</el-col>
</el-row>
</el-carousel-item>
</el-carousel>
</div>
</div>
<div class="right">
<div
class="input"
v-if="!detailData || Object.keys(detailData).length === 0"
>
<el-input
v-model="TrackingNumber"
:placeholder="placeholderText"
style="width: 660px; margin-right: 10px"
clearable
ref="trackingNumberRef"
size="medium"
@keyup.enter.native="trackcodeInput()"
></el-input>
<el-button type="primary" size="medium" @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 class="div-content">
<div :title="detail.userMark" class="div-item">
<span style="font-size: 18px">客户</span>
<p style="color: red; font-size: 30px">
{{ detail.userMark }}
</p>
</div>
<div :title="detail.orderNumber" class="div-item">
<span style="font-size: 18px">订单号</span>
<p style="color: red; font-size: 22px">
{{ detail.orderNumber }}
</p>
</div>
</div>
</div>
<div class="div-text">
<b>生产单信息</b>
<div class="div-content">
<div
:title="
isJMPOD === 'JMPOD'
? detail.subOrderNumber
: detail.podProductionNo
"
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 ? '多' : '单' }}
</p>
</div>
<div
:title="
isJMPOD === 'JMPOD' ? detail.process : detail.podProcessName
"
class="div-item"
>
<span>生产工艺</span>
<p>
{{
isJMPOD === 'JMPOD' ? detail.process : detail.podProcessName
}}
</p>
</div>
<div :title="detail.warehouseName" class="div-item">
<span>仓库</span>
<p>{{ detail.warehouseName }}</p>
</div>
<div :title="detail.baseSku" class="div-item">
<span>基版</span>
<p>{{ detail.baseSku }}</p>
</div>
<div :title="detail.supplierItemNo" class="div-item">
<span>货号</span>
<p>{{ detail.supplierItemNo }}</p>
</div>
<div :title="detail.variantSku" class="div-item">
<span>变体SKU</span>
<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>
<div
:title="detail.size"
class="div-item"
v-if="isJMPOD === 'POD'"
>
<span>尺寸</span>
<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'"
class="div-item"
>
<span>工厂</span>
<p>{{ detail.factoryCode || detail.supplierCode }}</p>
</div>
<div :title="detail.shopNumber" class="div-item">
<span>店铺单号</span>
<p>{{ detail.shopNumber }}</p>
</div>
<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>
</div> -->
<div :title="detail.createTime" class="div-item">
<span>创建时间</span>
<p>{{ detail.createTime }}</p>
</div>
<div :title="detail.expectDeliveryTime" class="div-item">
<span>期望交货时间</span>
<p>{{ detail.expectDeliveryTime }}</p>
</div>
<div
:title="
isJMPOD === 'JMPOD'
? detail.startStockingTime
: detail.productionConfirmTime
"
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 }}
</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 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"
>
{{ ['生产完成', '确定发货'][type - 1] }}
</el-button>
<div class="check">
<el-checkbox v-if="type === 1" v-model="isAutoSure">
自动完成上一单
</el-checkbox>
</div>
</div>
<div class="btn-down">
<div class="check">
<el-checkbox size="large" v-model="isDownloadImage">
扫码下载素材
</el-checkbox>
</div>
<el-button
size="medium"
:disabled="detail.importFactory"
@click="handleDownload"
style="width: 100%; height: 100%; font-size: 18px"
type="primary"
>
下载素材
</el-button>
</div>
</div>
<div
v-if="type !== 2"
class="div-text"
style="
flex: 1;
flex-shrink: 0;
display: flex;
flex-direction: column;
"
>
<div style="height: 100%" class="div-content" v-if="detail.note">
<b style="position: absolute; top: -12px">客户留言信息</b>
<div
v-for="(item, index) in detail.note"
:key="index"
class="div-item"
>
<span>{{ item.prop }}:</span>
<p>
{{ item.value }}
</p>
</div>
</div>
</div>
<div
v-if="type === 2"
class="div-text"
style="
flex: 1;
flex-shrink: 0;
display: flex;
flex-direction: column;
"
>
<div style="height: 100%" class="div-content">
<b style="position: absolute; top: -12px">本次发货数量</b>
<div
class="div-item"
style="
display: flex;
align-items: center;
width: 100%;
height: 100%;
font-size: 40px;
justify-content: center;
"
>
<h2 style="color: red; font-weight: bold">{{ sendNum }}</h2>
</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>
</el-dialog>
</template>
<script setup lang="tsx">
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
}
interface HistoryDataItem {
orderNumber: string
type: number
finished: boolean
}
const trackingNumberRef = ref(null)
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 dialogVisible = ref(false)
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 确保类型安全
const productInfo = ref({})
const TrackingNumber = ref('')
const props = defineProps({
currentStatus: {
default: 'IN_PRODUCTION',
type: String,
},
title: {
default: '',
type: String,
},
type: {
default: 0,
type: Number,
},
detailVisible: {
default: false,
type: Boolean,
},
detailData: {
default: null,
type: Object,
},
isJMPOD: {
default: 'POD',
type: String,
},
})
const emit=defineEmits(['update:detailVisible', 'close'])
watch(
() => props.detailVisible,
(newVal) => {
dialogVisible.value = newVal
if (newVal) {
const history = localStorage.getItem('historyData')
historyData.value = history ? JSON.parse(history) : []
historyData.value.forEach((el) => {
el.type = Number(el.type)
})
const len = historyData.value.filter((el) => 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 =
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产'
} else if (props.type === 2) {
placeholderText.value =
'扫描枪输入生产单号,录入下一单本单自动发货完成,最后一单扫两次完成发货'
}
sendNum.value = 0
// canlogisticsList('GNKD').then((res) => {
// logistics.value = res.data[0].logisticsWayList
// })
// shipForm.value = { shipmentType: '1' }
// nextTick(() => {
// if (trackingNumberRef.value) {
// ;(trackingNumberRef.value as HTMLInputElement).focus()
// }
// })
}
},
)
watch(
() => props.detailData,
(newVal) => {
console.log('this.detailData', newVal)
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 {
d.note = []
}
let arr = []
if (!d.imageAry) {
arr = [
{ url: d.variantImage, title: '正面', id: d.designId },
{ url: d.negativeImage, title: '反面', id: d.negativeDesignId },
].filter((el) => el.url)
} else {
arr =
typeof d.imageAry == 'string' ? JSON.parse(d.imageAry) : d.imageAry
arr = arr.concat([
{ url: d.negativeImage, title: '反面', id: d.negativeDesignId },
])
}
arr = arr.filter((el) => el.url)
arr = arr.map((el) => {
return {
...el,
...{
url: el.url.includes('http')
? el.url
: window.location.origin + '/upload/erp' + el.url,
},
}
})
arr = arr.filter((el) => 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 ')
detail.value = d
}
},
{ deep: true },
)
const confirmQuery = (len: HistoryDataItem[], i: number) => {
const el = len[i]
showConfirm(
`生产单号 ${el.orderNumber}${
el.type === 1 ? '生产完成' : '确定发货'
},取消则不提醒?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
.then(async () => {
TrackingNumber.value = el.orderNumber
await trackcodeInput()
await setData(el.orderNumber)
ElMessage.success(el.type === 1 ? '生产完成' : '确定发货')
if (len[i + 1]) {
confirmQuery(len, i + 1)
}
})
.catch(() => {
const index = historyData.value.findIndex(
(item) =>
item.orderNumber === el.orderNumber && item.type === props.type,
)
if (index >= 0) {
historyData.value.splice(index, 1)
localStorage.setItem('historyData', JSON.stringify(historyData.value))
}
if (len[i + 1]) {
confirmQuery(len, i + 1)
}
})
}
const changeStatus = () => {
if (!detail.value || Object.keys(detail.value).length <= 1) {
return ElMessage.warning('请扫码生产单号')
}
showConfirm(`确定${props.type === 1 ? '生产完成' : '确定发货'}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
setData(TrackingNumber.value)
})
}
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'
}
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)
if (props.type === 2) {
sendNum.value = sendNum.value + 1
}
if (orderNumber) {
const index = historyData.value.findIndex(
(el) => el.type === props.type && el.orderNumber === orderNumber,
)
if (index >= 0) {
// 扫单完成删除
historyData.value.splice(index, 1)
localStorage.setItem('historyData', JSON.stringify(historyData.value))
}
}
playAudio('weight_success')
detail.value = { imgList: [] }
} catch (e) {
console.error(e)
detail.value = { imgList: [] }
playAudio('weight_search_error')
}
}
}
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)
// })
}
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,
},
}
}
// 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) => {
let text = ''
switch (key) {
case 'weight_search_success':
text = ''
break
case 'weight_search_error':
text = '请录入生产单号'
break
case 'weight_success':
text = ''
break
case 'weight_repeat':
text = '称重复录入'
break
default:
text = '请录入跟踪号或重量'
break
}
if (message || text) ElMessage.warning(message || text)
let audio = document.createElement('audio')
console.log(key)
audio.src = audios[key]
audio.play()
}
const trackcodeInput = async () => {
if (!TrackingNumber.value) {
ElMessage.warning('请扫描生产单号')
playAudio('picking_warning')
return
}
const item = historyData.value.find(
(el) => el.orderNumber === TrackingNumber.value && el.type === props.type,
)
if (!item) {
// 记录扫单
historyData.value.push({
orderNumber: TrackingNumber.value,
type: props.type,
finished: false,
})
localStorage.setItem('historyData', JSON.stringify(historyData.value))
}
const orderNumber = TrackingNumber.value
TrackingNumber.value = ''
if (props.type === 1) {
if (isAutoSure.value) {
await setData(orderNumber)
}
} 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 d = JSON.parse(JSON.stringify(res.data))
if (d.note) {
d.note = JSON.parse(d.note)
} else {
d.note = []
}
let arr = []
if (!d.imageAry) {
arr = [
{ url: d.variantImage, title: '正面', id: d.designId },
{ url: d.negativeImage, title: '反面', id: d.negativeDesignId },
].filter((el) => el.url)
} else {
arr = typeof d.imageAry == 'string' ? JSON.parse(d.imageAry) : d.imageAry
arr = arr.concat([
{ url: d.negativeImage, title: '反面', id: d.negativeDesignId },
])
}
const result = []
console.log(arr)
arr = arr.filter((el) => el.url)
arr = arr.map((el) => {
return {
...el,
...{
url: el.url.includes('http')
? el.url
: window.location.origin + '/upload/erp' + el.url,
},
}
})
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 ')
detail.value = d
if (detail.value.importFactory) {
ElMessage.warning('只支持自有工厂的订单')
return
}
if (isDownloadImage.value) {
if (props.isJMPOD === 'JMPOD') {
download()
} else {
downloadAllWe()
}
}
playAudio('weight_search_success')
nextTick(() => {
if (trackingNumberRef.value) {
;(trackingNumberRef.value as HTMLInputElement).focus()
}
})
} catch (e) {
console.error(e)
productInfo.value = {}
playAudio('weight_search_error')
nextTick(() => {
if (trackingNumberRef.value) {
;(trackingNumberRef.value as HTMLInputElement).focus()
}
})
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
box-sizing: border-box;
flex: 1;
flex-shrink: 0;
overflow: hidden;
}
::v-deep .el-dialog {
display: flex;
height: calc(100% - 50px);
margin-top: 50px;
flex-direction: column;
}
.sure-btn {
position: absolute;
right: 62px;
top: 14px;
}
.detail-div {
display: flex;
height: 100%;
flex-direction: column;
justify-content: space-between;
.detail-images {
.scroll-list {
background: #ececec;
display: flex;
height: 100px;
width: 100%;
padding: 5px;
.scroll-content {
margin-left: 10px;
overflow-x: auto;
overflow-y: hidden;
flex: 1;
display: flex;
flex-wrap: nowrap;
flex-shrink: 0;
.scroll-item {
height: 100%;
min-width: 100px;
background: white;
margin-right: 5px;
}
}
.img-title {
display: flex;
flex-direction: column;
justify-content: center;
background: white;
padding: 10px;
b {
text-align: center;
color: black;
font-weight: bold;
font-size: 16px;
margin-bottom: 15px;
}
.id {
display: flex;
align-items: center;
padding: 3px 5px;
background: #ececec;
justify-content: center;
img {
width: 15px;
margin-right: 8px;
}
}
}
}
}
.detail-content {
display: flex;
width: 100%;
flex: 1;
margin-bottom: 10px;
flex-shrink: 0;
justify-content: space-between;
}
.right {
width: 710px;
height: 100%;
display: flex;
flex-direction: column;
.btn {
margin: 20px 0;
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
width: 100%;
.btn-sure,
.btn-down {
width: 49%;
position: relative;
.check {
position: absolute;
width: 144px;
height: 100%;
background: transparent;
display: flex;
align-items: center;
justify-content: center;
right: 0;
top: 1px;
}
}
}
.div-text {
.div-content {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
padding: 15px 10px;
box-sizing: border-box;
.div-item {
width: 50%;
margin-bottom: 10px;
display: flex;
align-items: center;
p {
font-weight: 400;
color: black;
}
span {
display: inline-block;
text-align: right;
width: 100px;
}
span::after {
content: ':';
margin: 0 3px;
}
}
}
b {
position: relative;
background: white;
top: 9px;
left: 13px;
padding: 0 10px;
font-size: 18px;
color: black;
z-index: 3;
}
.div-content {
position: relative;
border: 1px solid #ececec;
}
}
.input {
display: flex;
align-items: center;
margin: 30px 0;
}
}
.left {
flex: 1;
flex-shrink: 0;
margin-right: 20px;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
.left-image {
display: flex;
height: 100%;
flex-direction: column;
justify-content: center;
img {
height: auto;
width: 100%;
max-height: 90%;
}
b {
color: black;
font-size: 18px;
margin-bottom: 15px;
}
}
.left-images {
display: flex;
width: 95%;
height: 100%;
flex-direction: column;
b {
color: black;
text-align: center;
margin-bottom: 15px;
}
}
}
}
::v-deep .el-carousel__container {
height: 100%;
}
::v-deep .el-form-item__label {
font-weight: bold;
color: white;
}
::v-deep .el-dialog__title {
font-weight: bold;
font-size: 37px;
color: black;
position: relative;
left: 47%;
top: 13px;
}
.btn {
position: relative;
::v-deep .el-button {
span {
position: relative;
left: -30px;
}
}
.check {
::v-deep .el-checkbox__inner {
background-color: transparent !important;
border-color: white !important;
width: 12px;
height: 12px;
}
::v-deep .el-checkbox__inner::after {
left: 3px;
}
::v-deep .el-checkbox__label {
padding-left: 5px;
font-size: 12px;
color: white !important;
}
}
}
.warning {
font-size: 18px;
font-weight: bold;
color: #ff9900;
margin-left: 10px;
cursor: pointer;
}
</style>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</el-select> </el-select>
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>
<ElButton type="primary" @click="search">查询</ElButton> <ElButton type="primary" @click="loadDiffList">查询</ElButton>
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
</div> </div>
...@@ -114,6 +114,11 @@ ...@@ -114,6 +114,11 @@
<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>
<span v-if="status === 'IN_PRODUCTION'" class="item">
<ElButton type="success" dark @click="fastToProduction('快捷生产', 1)"
>快捷生产</ElButton
>
</span>
<span <span
v-if=" v-if="
status === 'TO_BE_CONFIRMED' || status === 'TO_BE_CONFIRMED' ||
...@@ -152,18 +157,247 @@ ...@@ -152,18 +157,247 @@
> >
</span> </span>
<span <span
v-if="
['TO_BE_CONFIRMED', 'IN_PRODUCTION', 'PART_SHIPPING'].includes(
status,
)
"
class="item"
>
<ElButton type="primary" @click="refreshProduct"
>刷新商品信息</ElButton
>
</span>
<span
v-if="status === 'IN_PRODUCTION' || status === 'PART_SHIPPING'" v-if="status === 'IN_PRODUCTION' || 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">
<ElButton type="danger" @click="voidedBtn">作废</ElButton>
</span>
</div> </div>
<div v-if="status == 'IN_PRODUCTION'" class="card-mode">
<div v-loading="loading" class="card-list">
<div <div
v-for="cardItem in CardOrderList"
:key="cardItem.id"
class="card-list_item"
@click="cardClick(cardItem)"
>
<CardWrapper
:card-item="cardItem"
:class="{ active: isSelectStatused(cardItem) }"
>
<template #top_right> 工厂类型 </template>
<template #bottom_left>
<span
v-if="cardItem.thirdSubOrderNumber"
title="生产单号"
class="base_sku"
@click.stop="copy(cardItem.thirdSubOrderNumber, '生产单号')"
>
{{ cardItem.thirdSubOrderNumber }}
</span>
</template>
<template #operations>
<Icon name="caozuorizhi" @click.stop="operationLog(cardItem)">
<template #title>
<title>操作日志</title>
</template>
</Icon>
<Icon
name="chakanxiangqing"
@click.stop="submitReview(cardItem, true)"
>
<template #title>
<title>查看详情</title>
</template>
</Icon>
</template>
<template #images>
<div class="flex-between">
<div class="images-position">
<div
v-for="(item, index) in cardItem.images"
:key="index"
:title="
item.ename
? item.ename === 'front'
? '正面图片'
: '反面图片'
: ''
"
:style="
currentImage === item.image && currentId === cardItem.id
? 'border-color: red'
: ''
"
class="item-image"
@click="changeImages(item, cardItem)"
>
<img :src="item.image" height="28" />
</div>
</div>
<b
:style="{
color:
cardItem.customizedQuantity > 1 ? 'red' : '#67C23A',
}"
>
{{ cardItem.customizedQuantity > 1 ? '多' : '单' }}
</b>
</div>
</template>
<template #info>
<div
style="height: 110px; font-size: 12px; padding: 10px 5px 0"
>
<el-row class="el_row">
<el-col :span="14" :offset="0">
<el-tooltip
class="item"
effect="dark"
:content="cardItem.baseSku"
placement="bottom"
>
<span
title="基版"
style="
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
display: inline-block;
"
>
{{ cardItem.baseSku }}
</span>
</el-tooltip>
</el-col>
<el-col :span="10" :offset="0" style="text-align: right">
<el-tooltip
class="item"
effect="dark"
:content="'数量'"
placement="bottom"
>
<span>数量:{{ cardItem.num }}</span>
</el-tooltip>
</el-col>
</el-row>
<el-row>
<el-col :span="14" :offset="0" style="white-space: nowrap">
<span>货号:</span>
<span
:title="cardItem.supplierItemNo"
style="
display: inline-block;
width: calc(100% - 38px);
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
"
>
{{ cardItem.supplierItemNo || '--' }}
</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>
</el-row>
<el-row style="margin-top: 5px">
<el-col
:span="12"
:offset="0"
style="
white-space: nowrap;
display: flex;
align-items: center;
"
>
<span>工艺:</span>
<span
:title="cardItem.process"
style="
display: inline-block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
"
>
{{ cardItem.process }}
</span>
</el-col>
<el-col :span="12" :offset="0" style="text-align: right">
<span title="期望交货时间">
{{ 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}`"
style="
display: inline-block;
width: 100%;
overflow: hidden;
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}小时` }}
</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>
</div>
</div>
</div>
<div
v-else
ref="tableWrapperRef" ref="tableWrapperRef"
v-loading="loading" v-loading="loading"
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"
...@@ -487,6 +721,15 @@ ...@@ -487,6 +721,15 @@
> >
<LogList :log-list="logList" /> <LogList :log-list="logList" />
</el-dialog> </el-dialog>
<fastProduction
:title="fastTitle"
:isJMPOD="'JMPOD'"
:type="fastType"
:detailData="detailData"
v-model="detailVisible"
:currentStatus="currentStatus"
@close="fastClose"
></fastProduction>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { import {
...@@ -500,6 +743,9 @@ import { ...@@ -500,6 +743,9 @@ import {
exportOrder, exportOrder,
getLogList, getLogList,
updateRemarkApi, updateRemarkApi,
refreshJMProductInfo,
reasonInvalidationApi,
getCardOrderList,
} from '@/api/podOrder' } from '@/api/podOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
...@@ -507,7 +753,11 @@ import { ...@@ -507,7 +753,11 @@ import {
ProductList, ProductList,
LogisticsData, LogisticsData,
ShipmentForm, ShipmentForm,
CardOrderItem,
cardImages,
} from '@/types/api/order' } from '@/types/api/order'
import fastProduction from '../fastProduction.vue'
import CardWrapper from '@/components/CardPods.vue'
import { CustomColumn } from '@/types/table' import { CustomColumn } from '@/types/table'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
...@@ -546,7 +796,6 @@ const getWeekRange = (weeks = 0, type: 'past' | 'future' = 'past') => { ...@@ -546,7 +796,6 @@ const getWeekRange = (weeks = 0, type: 'past' | 'future' = 'past') => {
type === 'past' ? now.subtract(weeks, 'week') : now.add(weeks, 'week') type === 'past' ? now.subtract(weeks, 'week') : now.add(weeks, 'week')
return [start.startOf('week').toDate(), start.endOf('week').toDate()] return [start.startOf('week').toDate(), start.endOf('week').toDate()]
} }
const pickerOptions = { const pickerOptions = {
shortcuts: [ shortcuts: [
{ {
...@@ -598,9 +847,8 @@ const pickerOptions = { ...@@ -598,9 +847,8 @@ const pickerOptions = {
const timeRange = ref<string[]>([]) const timeRange = ref<string[]>([])
const tabsNav = ref<Tab[]>() const tabsNav = ref<Tab[]>()
const status = ref('TO_BE_CONFIRMED') const status = ref('TO_BE_CONFIRMED')
const [tableWrapperRef, thOrderDetailWidth] = useElTableColumnWidth( const [tableWrapperRef, thOrderDetailWidth, updateColumnWidth] =
'table th.th-order-detail', useElTableColumnWidth('table th.th-order-detail')
)
const loadTabData = async () => { const loadTabData = async () => {
try { try {
const res = await getOrderTabData() const res = await getOrderTabData()
...@@ -609,14 +857,116 @@ const loadTabData = async () => { ...@@ -609,14 +857,116 @@ const loadTabData = async () => {
// showError(error) // showError(error)
} }
} }
const CardOrderList = ref<CardOrderItem[]>([])
const loadCardList = async () => {
try {
const res = await getCardOrderList(
{
...searchForm.value,
status: status.value,
timeType: searchForm.value.timeType,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
},
currentPage.value,
pageSize.value,
)
CardOrderList.value = res.data.records.map((item: CardOrderItem) => {
if (!item.imageAry) {
const images = []
if (item.variantImage) {
images.push({
ename: 'front',
cname: '正面',
image: item.variantImage,
})
}
if (item.negativeImage) {
images.push({
ename: 'back',
cname: '反面',
image: item.negativeImage,
})
}
item.images = images
} else {
if (item.imageAry) {
const images = JSON.parse(item.imageAry)
item.images = images.map((e) => {
return {
ename: '',
cname: '',
image: e.url,
}
})
}
}
return item
})
} catch (error) {
// showError(error)
}
}
const currentImage = ref('')
const currentId = ref(undefined)
const changeImages = (item: cardImages, data: CardOrderItem) => {
currentImage.value = item.image
// data.designId = item.designId
currentId.value = data.id
data.variantImage = item.image
// if (data.productList) {
// data.productList[0].variantImage = item.image
// }
}
const fastTitle = ref('')
const detailData = ref({})
const detailVisible = ref(false)
const fastType = ref<null | number>(null)
const fastToProduction = (title: string, type: number) => {
detailData.value = {}
detailVisible.value = true
fastTitle.value = title
fastType.value = type
}
const cardClick = (data: CardOrderItem) => {
const status = isSelectStatused(data)
if (status) {
selection.value = selection.value.filter(
(item: CardOrderItem) => item.id !== data.id,
)
} else {
selection.value.push(data)
}
}
const isSelectStatused = (data: CardOrderItem) => {
const index = selection.value.findIndex(
(item: CardOrderItem) => item.id === data.id,
)
return index !== -1
}
const changeTab = (item: Tab) => { const changeTab = (item: Tab) => {
status.value = item.status ?? '' status.value = item.status ?? ''
searchForm.value.timeType = null searchForm.value.timeType = null
loading.value = false
loadDiffList()
}
// 根据不同状态调用不同接口
const loadDiffList = () => {
if (status.value === 'IN_PRODUCTION') {
loadCardList()
} else {
search() search()
updateColumnWidth()
}
} }
const [searchForm] = useValue<SearchForm>({ const [searchForm] = useValue<SearchForm>({
timeType: null, timeType: null,
shopNumber: '', shopNumber: '',
order: 'desc', order: 'desc',
}) })
...@@ -676,9 +1026,8 @@ const { ...@@ -676,9 +1026,8 @@ const {
onCurrentPageChange: handleCurrentChange, onCurrentPageChange: handleCurrentChange,
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList({
query: (page, pageSize) => query: (page, pageSize) => {
getOrderList( const commonParams = {
{
...searchForm.value, ...searchForm.value,
status: status.value, status: status.value,
timeType: searchForm.value.timeType, timeType: searchForm.value.timeType,
...@@ -690,10 +1039,51 @@ const { ...@@ -690,10 +1039,51 @@ const {
timeRange.value && timeRange.value.length > 0 timeRange.value && timeRange.value.length > 0
? timeRange.value[1] ? timeRange.value[1]
: null, : null,
}
// 动态选择接口
const fetchData =
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) => {
// if (!item.imageAry) {
// const images = []
// if (item.variantImage) {
// images.push({
// ename: 'front',
// cname: '正面',
// image: item.variantImage,
// })
// }
// if (item.negativeImage) {
// images.push({
// ename: 'back',
// cname: '反面',
// image: item.negativeImage,
// })
// }
// item.images = images
// } else {
// if (item.imageAry) {
// const images = JSON.parse(item.imageAry)
// item.images = images.map((e) => {
// return {
// ename: '',
// cname: '',
// image: e.url,
// }
// })
// }
// }
// return item
// })
// res.data.records = cardList
// return res.data
// } else {
return res.data
// }
})
}, },
page,
pageSize,
).then((res) => res.data),
}) })
// 发货 // 发货
const { const {
...@@ -712,7 +1102,7 @@ const { ...@@ -712,7 +1102,7 @@ const {
onShipmentDialogOpened, onShipmentDialogOpened,
} = useShipment(() => { } = useShipment(() => {
loadTabData() loadTabData()
search() loadDiffList()
}) })
const rules = reactive<FormRules<ShipmentForm>>({ const rules = reactive<FormRules<ShipmentForm>>({
shippingWay: [ shippingWay: [
...@@ -749,6 +1139,45 @@ const getLogisticsList = async () => { ...@@ -749,6 +1139,45 @@ const getLogisticsList = async () => {
//showError(error) //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 openAll = (row: OrderData) => {
row.moreable = !row.moreable row.moreable = !row.moreable
} }
...@@ -777,7 +1206,7 @@ const confirmProduce = async () => { ...@@ -777,7 +1206,7 @@ const confirmProduce = async () => {
const ids = selection.value.map((item) => item.id) const ids = selection.value.map((item) => item.id)
try { try {
const res = await confirmProductionOrder(ids) const res = await confirmProductionOrder(ids)
search() loadDiffList()
await loadTabData() await loadTabData()
ElMessage.success(res.message) ElMessage.success(res.message)
} catch (e) { } catch (e) {
...@@ -813,6 +1242,21 @@ const arraySpanMethod = ({ columnIndex }: SpanMethodProps) => { ...@@ -813,6 +1242,21 @@ const arraySpanMethod = ({ columnIndex }: SpanMethodProps) => {
return [1, 6] return [1, 6]
} }
} }
const copy = (text: string): void => {
const oInput = document.createElement('input')
oInput.value = text
oInput.style.position = 'absolute'
oInput.style.opacity = '0'
oInput.style.pointerEvents = 'none'
document.body.appendChild(oInput)
oInput.select()
if (document.execCommand('copy')) {
ElMessage.success('复制成功')
} else {
ElMessage.error('复制失败,请手动复制')
}
document.body.removeChild(oInput)
}
const onChangeCurrentRow = (item: ProductList) => { const onChangeCurrentRow = (item: ProductList) => {
currentRow.value = item currentRow.value = item
} }
...@@ -834,7 +1278,7 @@ const cancelOrder = async (id: number) => { ...@@ -834,7 +1278,7 @@ const cancelOrder = async (id: number) => {
offset: window.innerHeight / 2, offset: window.innerHeight / 2,
}) })
loadTabData() loadTabData()
search() loadDiffList()
} catch (e) { } catch (e) {
// showError(e) // showError(e)
} }
...@@ -863,7 +1307,35 @@ const addInternalTag = async () => { ...@@ -863,7 +1307,35 @@ const addInternalTag = async () => {
) )
ElMessage.success(res.message) ElMessage.success(res.message)
loadTabData() loadTabData()
search() 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) { } catch (e) {
// showError(e) // showError(e)
} }
...@@ -963,7 +1435,7 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => { ...@@ -963,7 +1435,7 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => {
try { try {
await updateRemarkApi(id, value) await updateRemarkApi(id, value)
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() loadDiffList()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -981,6 +1453,63 @@ onMounted(() => { ...@@ -981,6 +1453,63 @@ onMounted(() => {
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.card-mode {
padding-top: 10px;
overflow: auto;
.card-list {
flex: 1;
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-template-rows: max-content;
gap: 10px;
.card-list_item {
border: 1px solid #eee;
border-top-left-radius: 10px;
background-color: #eee;
overflow: hidden;
cursor: pointer;
.base_sku {
background: rgba(255, 255, 255, 0.699);
font-size: 12px;
display: inline-block;
width: 100%;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 3px 5px;
border-radius: 2px;
}
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
.images-position {
display: flex;
height: 30px;
gap: 10px;
padding: 10px 6px 0;
.item-image {
width: 30px;
height: 30px;
border: 1px solid #909399;
cursor: pointer;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
b {
margin-right: 5px;
font-size: 15px;
}
}
}
}
}
.tabs { .tabs {
display: flex; display: flex;
align-items: center; align-items: center;
......
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