Commit 45d4b949 by linjinhong

Merge branch 'dev_weighing_sorting' of…

Merge branch 'dev_weighing_sorting' of http://47.122.114.111:9999/qinjianhui/factory_front into dev_weighing_sorting
parents c6b3162c 1c8c8872
......@@ -63,6 +63,8 @@ export interface ILogisticsCompany {
authCode: string | null // varchar(500)
redirectUri: string | null // varchar(256)
createTime: string | null // timestamp
orderStatus: string | null // varchar(60)
signTime: string | null // timestamp
vat: string | null // varchar(60)
ioss: string | null // varchar(60)
basicType: number // int(11)
......
......@@ -38,6 +38,11 @@ export function syncReceiverAddress(data: number[]) {
)
}
export function getEmployeeListApi() {
return axios.get(`/factory/factoryUser/list`)
}
// 播种墙配货 扫码放入箱子
export function getPackingCnDataApi(
code: string,
......@@ -559,10 +564,11 @@ export function getListCraftApi() {
}
// 批量下载 列表
export function batchDownloadApi(currentPage: number, pageSize: number) {
export function batchDownloadApi(params: SearchForm, currentPage: number, pageSize: number) {
return axios.post<never, BaseRespData<never>>(
`factory/podBatchDownload/cn/list_page`,
{
...params,
currentPage,
pageSize,
},
......
......@@ -477,10 +477,11 @@ export function getListCraftApi() {
}
// 批量下载 列表
export function batchDownloadApi(currentPage: number, pageSize: number) {
export function batchDownloadApi(params: SearchForm, currentPage: number, pageSize: number) {
return axios.post<never, BaseRespData<never>>(
`factory/podBatchDownload/us/list_page`,
{
...params,
currentPage,
pageSize,
},
......@@ -625,6 +626,11 @@ export function getAccountCodeByFactoryIdApi(params: { token: string }) {
export function getLogisticsWayApi() {
return axios.get(`logisticsWay/usableAllList`)
}
export function getEmployeeListApi() {
return axios.get(`/factory/factoryUser/list`)
}
// 打印拣货单item
export function printPickPdfByBatchNumberApi(params: {
batchArrangeNumber: string
......
......@@ -48,6 +48,12 @@ export interface SearchForm {
size?: string
logisticsCompanyCode?: string
tagsIdArr?: (number | null)[]
craftType?: string
downloadStatus?: number
syntheticStatus?: number
automaticComposing?: number
employeeId?: number
blocking?: boolean
blocking?: boolean
}
export interface PodCnOrderListData {
......@@ -115,6 +121,7 @@ export interface ProductList {
variantImage?: string
craftPrice?: number
craftCode?: string
craftType?: string
previewImgs?: []
platform?: string
imageAry?: string
......
......@@ -44,6 +44,11 @@ export interface SearchForm {
size?: string
tagsIdArr?: (number | null)[]
replaceShipment?: number | null
craftType?: string
downloadStatus?: number
syntheticStatus?: number
automaticComposing?: number
employeeId?: number
blocking?: boolean
}
export interface PodUsOrderListData {
......@@ -114,6 +119,7 @@ export interface ProductList {
variantImage?: string
craftPrice?: number
craftCode?: string
craftType?: string
platform?: string
imageAry?: string
previewImgs?: []
......
......@@ -27,6 +27,23 @@
<template #top>
<el-card>
<el-form inline :model="searchForm" ref="searchFormRef">
<el-form-item label="创建时间">
<el-date-picker
v-model="tradingTime"
:shortcuts="pickerOptions.shortcuts"
:default-time="[
new Date(0, 0, 0, 0, 0, 0),
new Date(0, 0, 0, 23, 59, 59),
]"
type="datetimerange"
start-placeholder="开始时间"
end-placeholder="结束时间"
clearable
style="width: 260px"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="物流跟踪号">
<el-input
v-model="searchForm.trackNumber"
......@@ -87,6 +104,9 @@
<template #shipmentType="{ row }">
{{ ['自有物流', '工厂物流'][row.shipmentType] }}
</template>
<template #shippingAge="{ row }">
{{ getShippingAge(row) }}
</template>
</TableView>
</div>
<div class="pagination">
......@@ -139,7 +159,124 @@ const searchForm = ref<SearchForm>({
shopNumber: '',
trackNumber: '',
})
function getStartTime() {
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
return `${year}-${month}-${day} 00:00:00`
}
const tradingTime = ref<string[]>([])
const pickerOptions = {
shortcuts: [
{
text: '今日',
value: () => {
const start = new Date(new Date(getStartTime()).getTime())
const end = new Date()
return [start, end]
},
},
{
text: '昨天',
value: () => {
const start = new Date()
const end = new Date(new Date(getStartTime()).getTime() - 1)
start.setTime(end.getTime() - 3600 * 1000 * 24 * 1 + 1)
return [start, end]
},
},
{
text: '最近7天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6)
return [start, end]
},
},
{
text: '最近14天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 13)
return [start, end]
},
},
{
text: '最近30天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 29)
return [start, end]
},
},
{
text: '本星期',
value: () => {
const end = new Date()
const start = new Date()
const nowDay = new Date().getDay() - 1
start.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDay,
)
return [start, end]
},
},
{
text: '上星期',
value: () => {
const end = new Date()
const start = new Date()
const nowDay = new Date().getDay() - 1
end.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDay - 1,
)
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7 + 1)
return [start, end]
},
},
{
text: '这个月',
value: () => {
const end = new Date()
const start = new Date()
const nowDate = new Date().getDate() - 1
start.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDate,
)
return [start, end]
},
},
{
text: '上个月',
value: () => {
const date = new Date()
let year = date.getFullYear()
let month = date.getMonth()
const end = new Date(
new Date(`${year}-${month + 1}-1 00:00:00`).getTime() - 1,
)
if (month === 0) {
month = 12
year = year - 1
}
const start = new Date(
new Date(`${year}-${month}-1 00:00:00`).getTime(),
)
return [start, end]
},
},
{
text: '历史',
value: () => {
return ['', '']
},
},
],
}
const treeData = ref<LogisticsTrackingTree[]>()
const treeRef = ref<InstanceType<typeof ElTree>>()
const tableRef = ref<{ internalIsMore?: boolean }>()
......@@ -183,6 +320,19 @@ const tableColumns = computed(() => {
align: 'center',
},
{
label: '创建时间',
prop: 'createTime',
width: 200,
align: 'center',
},
{
label: '发货时效(天)',
prop: 'shippingAge',
slot: 'shippingAge',
width: 120,
align: 'center',
},
{
label: '订单状态',
prop: 'orderStatus',
slot: 'orderStatus',
......@@ -261,13 +411,38 @@ const getTree = async () => {
console.error(e)
}
}
/** 计算发货时效(天)
* 已签收 → 停止计时
* <12h = 0天;≥12h & <24h = 1天;≥48h = 2天 ...
*/
function getShippingAge(row: ILogisticsCompany): number {
// 成功签收就固定: 已签收时间 - 创建时间
if (row.orderStatus === 'COMPLETE') {
const signTime = new Date(row.signTime ?? 0).getTime()
const createTime = new Date(row.createTime ?? 0).getTime()
return msToDays(signTime - createTime)
}
// 未签收:当前时间 - 创建时间
const now = Date.now()
const create = new Date(row.createTime ?? 0).getTime()
return msToDays(now - create)
}
/** 毫秒 → 天数(≥12h 向上取整) */
function msToDays(ms: number): number {
const hours = ms / (1000 * 60 * 60)
if (hours < 12) return 0
return Math.ceil(hours / 24)
}
// 列表查询
async function getData() {
const res = await logisticsTrackingPage({
trackingStatus: nodeId.value,
shopNumber: searchForm.value.shopNumber,
trackNumber: searchForm.value.trackNumber,
startTime: tradingTime.value && tradingTime.value[0],
endTime: tradingTime.value && tradingTime.value[1],
queryDateType: tradingTime.value && 1,
})
leftData.value = res.data.records
pagination.value.total = res.data.total
......
......@@ -59,4 +59,7 @@ export interface LogisticsTrackingParams {
trackNumber?: number | string
shopNumber?: string | number
trackingStatus?: number
startTime?: string
endTime?: string
queryDateType?: number | string
}
......@@ -215,6 +215,7 @@ import {
IsizeType,
IPropertyResponseItem,
Iprice,
IPropertyItem,
} from './types/index.ts'
const [editForm, resetEditForm] = useValue<IsupplierType>({})
......@@ -952,7 +953,7 @@ async function addPice(product: IgoodsType) {
}
// 辅助函数:创建属性映射
function createPropertyMap(propertyList: any[]): Map<number, number[]> {
function createPropertyMap(propertyList: IPropertyItem[]): Map<number, number[]> {
const map = new Map<number, number[]>()
propertyList.forEach((item) => {
......
......@@ -20,7 +20,7 @@ export interface IgoodsType {
customProductItemList?: Iprice[]
supplierPriceItemList?: Iprice[]
customProductInfo?: IgoodsType
propertyList?: []
propertyList?: IPropertyItem[]
supplyPriceRange?: string
}
export interface IsupplierType {
......@@ -57,6 +57,11 @@ export interface IPropertyResponseItem {
valueList: IcolorType[] | IsizeType[]
}
export interface IPropertyItem {
propertyId?: number
valueId?: number
}
export interface Iprice {
productItemSku?: string
productItemImage?: string
......
......@@ -1059,7 +1059,7 @@ const {
})
const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) {
if (item.costPrice !== 0 && !item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价')
return
}
......
......@@ -1063,7 +1063,7 @@ const {
})
const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) {
if (item.costPrice !== 0 && !item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价')
return
}
......
......@@ -1216,7 +1216,7 @@ const {
})
const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) {
if (item.costPrice !== 0 && !item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价')
return
}
......
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