Commit 580073d4 by linjinhong
parents b9d7b2a2 68d7c71b
......@@ -148,7 +148,7 @@ export function getUniuniList() {
}
// 获取tictok物流承运商
export function getTiktokCarrier() {
return axios.get<never, BaseRespData<{ name: string; id: number }[]>>(
return axios.get<never, BaseRespData<{ name: string; id: string,typeCode:string,label:string }[]>>(
'logisticsWay/getTiktokShippingProvider',
)
}
......
......@@ -44,6 +44,7 @@ export interface SearchForm {
interceptStatus?: number | string
sizeType?: number | null
tagsId?: string
source?: string
tagsIdArr?: (number | null)[]
}
export interface PodCnOrderListData {
......@@ -222,9 +223,9 @@ export interface CraftListData {
craftCode: string
}
export interface PackingData {
podProductionNo?: string; // 生产单号(PSCD 开头)
jomallCustomNo?: string; // 一件定制号(16 位数字 或 S- 开头)
jomallPsdCustomNo?: string; // 满印定制号(JMSC/GCSC 开头)
podJomallNo?: string; // POD 平台号(JMPSC/GCPS 经过正则提取)
sku?: string; // 普通 SKU(兜底)
}
\ No newline at end of file
podProductionNo?: string // 生产单号(PSCD 开头)
jomallCustomNo?: string // 一件定制号(16 位数字 或 S- 开头)
jomallPsdCustomNo?: string // 满印定制号(JMSC/GCSC 开头)
podJomallNo?: string // POD 平台号(JMPSC/GCPS 经过正则提取)
sku?: string // 普通 SKU(兜底)
}
......@@ -4,6 +4,8 @@ import {
ElScrollbar,
ElCheckbox,
ElCheckboxGroup,
ElRadioGroup,
ElRadio,
ElInput,
} from 'element-plus'
......@@ -24,6 +26,11 @@ const styles = {
flexWrap: 'wrap',
backgroundColor: '#efefef',
},
checkbox: {
width: '33.3333%',
'margin-right': '0px !important',
},
} as const
interface ICompanyList {
......@@ -35,41 +42,64 @@ interface IwayList {
id: string
}
interface IAllList {
factoryId: number
factoryId?: number
id: number
name: string
serviceCode: string
siteUrl: string
status: number
uinuinWarehouseId: number | null
updateTime: string
warehouseId: number
warehouseName: string
serviceCode?: string
siteUrl?: string
status?: number
uinuinWarehouseId?: number | null
updateTime?: string
warehouseId?: number
warehouseName?: string
wayList?: IwayList[]
}
export default defineComponent({
name: 'CustomizeForm',
props: {
modelValue: {
type: Array as PropType<(string | number)[]>,
type: [Array, String, Number] as PropType<
(string | number)[] | string | number
>,
default: () => [],
// 可选:添加自定义验证器确保类型安全
validator: (value: unknown) => {
return (
Array.isArray(value) ||
typeof value === 'string' ||
typeof value === 'number'
)
},
},
companyList: {
type: Array as PropType<IAllList[]>,
type: Array as PropType<IAllList[] | ICompanyList[]>,
default: () => [],
},
isRadio: {
type: Boolean,
default: false,
},
},
emits: ['update:modelValue'],
setup(props, { emit }) {
const companyList = ref<ICompanyList[]>([])
const templeCompanyList = ref<ICompanyList[] | IwayList[] | IAllList[]>([])
const allList = ref<IAllList[]>([])
const allWayLists = ref<IwayList[]>([])
const selectedList = ref<(string | number)[]>([])
const selectedRadioList = ref<string | number>()
const waysName = ref('')
const searchName = ref('')
watch(
() => props.modelValue,
(newVal) => {
selectedList.value = newVal
if (props.isRadio) {
selectedRadioList.value = newVal as string | number
console.log('waysName', waysName.value)
} else {
selectedList.value = newVal as (string | number)[]
}
},
{
immediate: true,
......@@ -78,23 +108,40 @@ export default defineComponent({
)
watch(
[() => selectedList.value, () => props.companyList],
[
() => selectedList.value,
() => props.companyList,
() => selectedRadioList.value,
],
(newVal) => {
emit('update:modelValue', newVal[0])
allList.value = newVal[1]
companyList.value = transformData(newVal[1])
if (newVal[1]?.length) {
waysName.value = newVal[1]
.filter((item) => {
if (newVal[0].includes(item.id)) {
return item.name
}
})
.map((item) => item.name)
.join(',')
// emit('waysName', res)
console.log(87, waysName.value)
// console.log(90, newVal)
if (props.isRadio) {
emit('update:modelValue', newVal[2])
companyList.value = newVal[1] as ICompanyList[]
allWayLists.value = props.companyList.flatMap(
(company) => company.wayList,
) as IwayList[]
waysName.value =
allWayLists.value.find((el: IwayList) => newVal[2] === el.id)
?.name || ''
} else {
emit('update:modelValue', newVal[0])
allList.value = newVal[1] as IAllList[]
companyList.value = transformData(newVal[1] as IAllList[])
if (newVal[1]?.length) {
waysName.value = (newVal[1] as IAllList[])
.filter((item) => {
if (newVal[0].includes(item.id)) {
return item.name
}
})
.map((item) => item.name)
.join(',')
// emit('waysName', res)
// console.log(87, waysName.value)
}
}
},
{ deep: true, immediate: true },
......@@ -127,6 +174,31 @@ export default defineComponent({
return (company: ICompanyList) => statusMap.get(company.warehouseName)
})
function fuzzySearch<T>(
items: T[],
searchTerm: string,
key: keyof T = 'name' as keyof T,
): T[] {
// 空搜索返回所有元素
if (!searchTerm.trim()) {
return [...items]
}
// 将搜索词转为小写(不区分大小写)
const searchLower = searchTerm.toLowerCase()
return items.filter((item) => {
// 获取属性值
const value = item[key]
// 确保属性值存在且为字符串
if (typeof value !== 'string') return false
// 将属性值转为小写并检查是否包含搜索词
return value.toLowerCase().includes(searchLower)
})
}
function transformData(data: IAllList[]) {
const warehouseMap = new Map()
for (const item of data) {
......@@ -154,10 +226,13 @@ export default defineComponent({
return () => (
<ElPopover
width="650px"
width="750px"
placement="bottom-start"
trigger="click"
popper-style={{ padding: 0 }}
onUpdate:visible={(value) => {
if (value) searchName.value = ''
}}
v-slots={{
reference: () => (
<ElInput
......@@ -168,36 +243,128 @@ export default defineComponent({
),
}}
>
<ElScrollbar class="scroll-container" maxHeight="450px">
{companyList.value.map((company, index) => (
<div class="companyBox" key={index}>
<div style={styles.titleBox}>
<div class="title">{company.warehouseName}</div>
<ElCheckbox
modelValue={getCompanySelectedStatus.value(company)}
onChange={(v) => setCheckAll(company, v as boolean)}
class="selectAll"
>
全选
</ElCheckbox>
</div>
<ElInput
modelValue={searchName.value}
onUpdate:modelValue={(value) => {
if (props.isRadio) {
templeCompanyList.value = fuzzySearch(allWayLists.value, value)
} else {
templeCompanyList.value = fuzzySearch(allList.value, value)
}
console.log('templeCompanyList', templeCompanyList.value)
searchName.value = value
}}
clearable
style={{ width: '200px', padding: '10px' }}
placeholder="请搜索承运商"
/>
<ElScrollbar
class="scroll-container"
maxHeight="450px"
style={{ 'border-top': '1px solid #eee' }}
>
{!searchName.value ? (
companyList.value.map((company, index) => (
<div class="companyBox" key={index}>
<div style={styles.titleBox}>
<div class="title">{company.warehouseName}</div>
{!props.isRadio && (
<ElCheckbox
modelValue={getCompanySelectedStatus.value(
company as ICompanyList,
)}
onChange={(v) =>
setCheckAll(company as ICompanyList, v as boolean)
}
class="selectAll"
>
全选
</ElCheckbox>
)}
</div>
<ElCheckboxGroup
modelValue={selectedList.value}
onUpdate:modelValue={(value) => (selectedList.value = value)}
style={styles.checkboxGroup}
>
{company.wayList.map((item) => (
{props.isRadio ? (
<ElRadioGroup
modelValue={selectedRadioList.value}
onUpdate:modelValue={(value) => {
console.log('company', value)
selectedRadioList.value = value as string | number
}}
style={styles.checkboxGroup}
>
{company.wayList?.map((item) => (
<div title={item.name} style={styles.checkbox}>
<ElRadio
label={item.name}
value={item.id}
key={`item-${item.id}`}
>
{item.name}
</ElRadio>
</div>
))}
</ElRadioGroup>
) : (
<ElCheckboxGroup
modelValue={selectedList.value}
onUpdate:modelValue={(value) =>
(selectedList.value = value)
}
style={styles.checkboxGroup}
>
{(company as ICompanyList).wayList.map((item) => (
<div title={item.name} style={styles.checkbox}>
<ElCheckbox
label={item.name}
value={item.id}
key={`item-${item.id}`}
class="checkboxItem"
/>
</div>
))}
</ElCheckboxGroup>
)}
</div>
))
) : props.isRadio ? (
<ElRadioGroup
modelValue={selectedRadioList.value}
onUpdate:modelValue={(value) => {
console.log('company', value)
selectedRadioList.value = value as string | number
}}
style={styles.checkboxGroup}
>
{(templeCompanyList.value as IwayList[]).map((item) => (
<div title={item.name} style={styles.checkbox}>
<ElRadio
label={item.name}
value={item.id}
key={`item-${item.id}`}
>
{item.name}
</ElRadio>
</div>
))}
</ElRadioGroup>
) : (
<ElCheckboxGroup
modelValue={selectedList.value}
onUpdate:modelValue={(value) => (selectedList.value = value)}
style={styles.checkboxGroup}
>
{(templeCompanyList.value as IwayList[]).map((item) => (
<div title={item.name} style={styles.checkbox}>
<ElCheckbox
label={item.name}
value={item.id}
key={`item-${item.id}`}
class="checkboxItem"
/>
))}
</ElCheckboxGroup>
</div>
))}
</div>
))}
</ElCheckboxGroup>
)}
</ElScrollbar>
</ElPopover>
)
......
......@@ -42,7 +42,7 @@
v-model="editForm"
:config="formConfig"
form-item-width="100%"
labelWidth="110"
label-width="110"
>
</CustomizeForm>
......@@ -70,6 +70,7 @@
defineOptions({
name: 'LogisticsMethod',
})
import LogisticsWaySelect from './components/LogisticsWaySelect.tsx'
import {
getLogisticsWayList,
addLogisticsWay,
......@@ -83,7 +84,7 @@ import {
getUniuniList,
getTiktokCarrier,
} from '@/api/logistics'
import type { FormItemRule } from 'element-plus'
import { WarehouseListData } from '@/types/api/podUsOrder'
import { ISeachFormConfig } from '@/types/searchType'
import { TableColumn } from '@/components/VxeTable'
......@@ -103,6 +104,7 @@ import { showConfirm } from '@/utils/ui'
import { Edit, Delete, List, WarningFilled } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es'
import UPARCELImage from '@/assets/images/UPARCEL物流编码.png'
const [searchForm] = useValue({})
const [editForm, resetEditForm] = useValue<LogisticsMethod>({
platformList: [
......@@ -140,6 +142,7 @@ const warehouseList = ref<WarehouseListData[]>([])
interface ImageList {
[key: string]: string
}
const imgeList = ref<ImageList>({
UPARCEL: UPARCELImage,
})
......@@ -182,6 +185,45 @@ const platformList = ref([])
const ruleNameList = ref([])
const uniuniList = ref([])
const logisticsCompanyList = ref([])
watch(
() => JSON.parse(JSON.stringify(editForm.value.platformList)),
(newValue, oldValue) => {
if (oldValue.length && newValue.length) {
// 遍历旧值数组
oldValue.forEach(
(
oldItem: { logisticsName: string; showPlatform: string[] },
index: number,
) => {
// 检查旧值项是否符合条件
if (
Array.isArray(oldItem.showPlatform) &&
oldItem.showPlatform.length === 1 &&
oldItem.showPlatform[0] === 'TIKTOK' &&
oldItem.logisticsName
) {
// 获取对应的新值项
const newItem = newValue[index]
// 检查新值项是否不再满足条件
if (
newItem &&
(!Array.isArray(newItem.showPlatform) ||
newItem.showPlatform.length === 0 ||
!newItem.showPlatform.includes('TIKTOK') ||
newItem.showPlatform.length > 1)
) {
// 清除 logisticsName
editForm.value.platformList[index].logisticsName = ''
}
}
},
)
}
},
{ deep: true },
)
const formConfig = computed<IFormConfig[]>(() => [
{ title: '物流基础信息' },
{
......@@ -370,9 +412,7 @@ const formConfig = computed<IFormConfig[]>(() => [
{
title: '平台物流名称',
fixed: 'last',
render: (item, formData) => {
console.log(283, item, formData)
render: (_, formData) => {
return (formData?.platformList as platformObj[])?.map(
(item: platformObj, index: number) => (
<div style="display: flex; width:100%">
......@@ -415,21 +455,21 @@ const formConfig = computed<IFormConfig[]>(() => [
required: true,
message: '请输入物流名称',
trigger: 'blur',
validator: (
_: FormItemRule,
value: string,
callback: (error?: string) => void,
) => {
if (value) callback()
},
},
]}
>
<el-select
v-model={item.logisticsName}
placeholder="请选择物流名称"
>
{tiktokCarriers.value?.map((el) => (
<el-option
label={el.name}
value={el.name}
key={el.id}
></el-option>
))}{' '}
</el-select>
<LogisticsWaySelect
v-model={item.logisticsName as string | number}
isRadio={true}
companyList={tiktokCarriers.value as ICompanyList[]}
></LogisticsWaySelect>
</el-form-item>
) : (
<el-form-item
......@@ -466,7 +506,7 @@ const formConfig = computed<IFormConfig[]>(() => [
{index >= 1 && (
<el-button
style="margin-left: 10px"
type="primary"
type="danger"
onClick={() => deleteCol(index)}
>
删除
......@@ -534,7 +574,16 @@ const tableConfig = ref<TableColumn[]>([
</span>
<span>
<span>{'物流名称:'}</span>
<span class="logistics-name">{el.logisticsName}</span>
{el.platform === 'TIKTOK' ? (
<span class="logistics-name">
{tiktokCarriers.value
?.flatMap((company) => company.wayList)
?.find((item) => el.logisticsName === item.id)?.name ||
el.logisticsName}
</span>
) : (
<span class="logistics-name">{el.logisticsName}</span>
)}
</span>
</div>
)),
......@@ -868,13 +917,33 @@ async function getAllList() {
}
}
const tiktokCarriers = ref<{ name: string; id: number }[]>([])
interface ICompanyList {
warehouseName: string
wayList: IwayList[]
}
interface IwayList {
name: string
id: string
}
const tiktokCarriers = ref<ICompanyList[]>([])
/**
* @description: 获取tictok物流承运商
*/
async function getTiktokCarriers() {
const { data } = await getTiktokCarrier()
tiktokCarriers.value = data
const labelTypeList = Array.from(new Set(data.map((e) => e.label)))
const result: ICompanyList[] = []
labelTypeList.forEach((label) => {
result.push({
warehouseName: label,
wayList: data.filter((e) => e.label === label),
})
})
tiktokCarriers.value = result
console.log(893, tiktokCarriers.value)
}
/**
......@@ -885,7 +954,9 @@ interface LogList {
createTime?: string
description?: string
}
const logList = ref<LogList[]>([])
async function showLog(row: LogisticsMethod) {
logDialogVisible.value = true
try {
......@@ -909,9 +980,11 @@ async function showLog(row: LogisticsMethod) {
margin-bottom: 10px;
}
}
.user-operate-btn {
margin-bottom: 10px;
}
.dialog-footer {
text-align: center;
}
......
......@@ -72,10 +72,10 @@
</el-form-item>
<el-form-item>
<el-input
ref="testingInput"
ref="testingInputRef"
v-model="barcode"
style="width: 400px"
placeholder="'请输入生产单号/ 主SKU'"
placeholder="请输入生产单号/ 主SKU"
@keyup.enter="barcodeInput"
></el-input>
</el-form-item>
......
......@@ -353,6 +353,22 @@
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="订单来源">
<ElSelect
v-model="searchForm.source"
placeholder="请选择"
clearable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in sourceList"
:key="index"
:value="item.id"
:label="item.name"
></ElOption>
</ElSelect>
</ElFormItem>
</ElForm>
<template #reference>
<el-button type="warning" @click="searchVisible = !searchVisible">
......@@ -1327,6 +1343,19 @@
</el-icon>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">订单来源:</span>
<span class="order-detail-item-value">
{{
row.source
? {
'jomall-erp': 'erp推送',
'third-party': '第三方推送',
}[row.source as 'jomall-erp' | 'third-party']
: ''
}}
</span>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">总克重:</span>
<span v-if="row.weight" class="order-detail-item-value">
{{ row.weight }}g
......@@ -2620,6 +2649,17 @@ const exportForm = ref({
resource: '',
})
const sourceList = [
{
name: 'erp推送',
id: 'jomall-erp',
},
{
name: '第三方推送',
id: 'third-party',
},
]
const exportData = () => {
exportVisible.value = true
}
......
<template>
<div class="card flex-column h-100 overflow-hidden">
<div class="header-filter-form">
<ElForm class="search-form" label-position="right" label-width="70px" :model="searchForm" size="default" inline>
<ElForm
class="search-form"
label-position="right"
label-width="70px"
:model="searchForm"
size="default"
inline
>
<!-- <div> -->
<ElFormItem label="仓库">
<ElSelect
......@@ -126,8 +133,8 @@
v-model="searchForm.customizedQuantity"
@click.stop="(e: Event) => handleRadioGroupClick(e)"
>
<el-radio-button label="single">单面</el-radio-button>
<el-radio-button label="multiple">多面</el-radio-button>
<el-radio-button label="single">单面</el-radio-button>
<el-radio-button label="multiple">多面</el-radio-button>
</el-radio-group>
</ElFormItem>
<ElFormItem label="数量">
......@@ -322,7 +329,7 @@
style="width: 150px"
>
<ElOption
v-for="(item, index) in logisticsWayList "
v-for="(item, index) in logisticsWayList"
:key="index"
:value="item.id"
:label="item.name"
......@@ -338,7 +345,7 @@
style="width: 150px"
>
<ElOption
v-for="(item, index) in sourceList "
v-for="(item, index) in sourceList"
:key="index"
:value="item.id"
:label="item.name"
......@@ -1508,9 +1515,10 @@
<span class="order-detail-item-value">
{{
row.source
? { 'jomall-erp': 'erp', 'third-party': '第三方推送' }[
row.source as 'jomall-erp' | 'third-party'
]
? {
'jomall-erp': 'erp推送',
'third-party': '第三方推送',
}[row.source as 'jomall-erp' | 'third-party']
: ''
}}
</span>
......@@ -2899,7 +2907,8 @@ import {
changeToFinished,
updateTrackingNumberAndRegister,
countTrackRegisterApi,
getCustomTagListApi, getLogisticsWayApi,
getCustomTagListApi,
getLogisticsWayApi,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -2971,18 +2980,18 @@ declare global {
}
const sourceList = [
{
name:'erp推送',
id:'jomall-erp'
name: 'erp推送',
id: 'jomall-erp',
},
{
name:'第三方推送',
id:'third-party'
}
name: '第三方推送',
id: 'third-party',
},
]
const tabsNav = ref<Tab[]>()
const isAuto = ref(true)
const countryList = ref([])
const logisticsWayList = ref<{name:string,id:number}[]>([])
const logisticsWayList = ref<{ name: string; id: number }[]>([])
const currentRow = ref<AddressInfo>({
receiverName: '',
receiverPhone: '',
......@@ -6169,8 +6178,8 @@ const getTagName = (row: ProductList) => {
: ''
}
const getLogisticsWay = async ()=>{
const {data} = await getLogisticsWayApi()
const getLogisticsWay = async () => {
const { data } = await getLogisticsWayApi()
logisticsWayList.value = data
}
......@@ -6525,15 +6534,14 @@ useRouter().beforeEach((to, from, next) => {
color: white;
font-weight: bold;
}
.search-form{
::v-deep .el-radio-button{
.search-form {
::v-deep .el-radio-button {
width: 75px;
.el-radio-button__inner{
.el-radio-button__inner {
width: 100%;
}
}
}
</style>
<style lang="scss">
.customize-select-style {
......
......@@ -6,7 +6,7 @@
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"types":[],
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
......
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