feat(crm): 客户增加同市标记,装卸段选客户时默认带入。
同市客户在运输计划装货、卸货段自动带出同市,同市运输只要求购买证。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a7b9386e79
commit
643221c61f
15 files changed
+152
-7
No files matched your search
@@ -245,7 +245,7 @@
|
||||
import { mobileStopIdentity } from '@/views/m/pl/plan/mobileStopIdentity'
|
||||
import MobilePlanDeliverySection from '@/views/m/pl/plan/MobilePlanDeliverySection.vue'
|
||||
import { Bottom, Delete, Plus, Search, Top } from '@element-plus/icons-vue'
|
||||
import { fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { fetchCustomerDetail, fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { customerStopPrefApi, type CustomerStopPref } from '@/api/pl/index'
|
||||
import PlAddressWithLibrary, {
|
||||
type PlAddressApplyPayload
|
||||
@@ -256,6 +256,7 @@
|
||||
import {
|
||||
canManualToggleStopDibang,
|
||||
createEmptyDeliveryForm,
|
||||
resolveCustomerSameCityFlag,
|
||||
resolveStopDibangDefaults,
|
||||
sumStopProductsPlanQty,
|
||||
type PlanDeliveryForm,
|
||||
@@ -331,6 +332,7 @@
|
||||
id: string
|
||||
customerName: string
|
||||
customerNo?: string
|
||||
sameCity?: number
|
||||
}
|
||||
|
||||
const activeIndex = ref(0)
|
||||
@@ -579,6 +581,7 @@
|
||||
products: [],
|
||||
generateDibang: 0,
|
||||
dibangDirection: 'none',
|
||||
sameCity: 0,
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
@@ -604,15 +607,34 @@
|
||||
products: [],
|
||||
generateDibang: defaults.generateDibang,
|
||||
dibangDirection: defaults.dibangDirection,
|
||||
sameCity: resolveCustomerSameCityFlag(customer?.sameCity),
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
void applySameCityFromCustomer(index, String(customerId))
|
||||
void applyDeliveryStopPref(index, String(customerId))
|
||||
}
|
||||
|
||||
async function applySameCityFromCustomer(index: number, customerId: string) {
|
||||
const identity = props.mobileSheet ? mobileStopIdentity(props.modelValue[index]) : undefined
|
||||
try {
|
||||
const res = await fetchCustomerDetail({ id: customerId })
|
||||
const data = pickBxData<{ sameCity?: number }>(res)
|
||||
if (!data) return
|
||||
if (props.mobileSheet) {
|
||||
index = props.modelValue.findIndex((row) => mobileStopIdentity(row) === identity)
|
||||
}
|
||||
const current = props.modelValue[index]
|
||||
if (!current || String(current.customerId) !== String(customerId)) return
|
||||
patchDelivery(index, { sameCity: resolveCustomerSameCityFlag(data.sameCity) })
|
||||
} catch {
|
||||
// 静默:不阻断选客户
|
||||
}
|
||||
}
|
||||
|
||||
async function applyDeliveryStopPref(index: number, customerId: string) {
|
||||
const identity = props.mobileSheet ? mobileStopIdentity(props.modelValue[index]) : undefined
|
||||
try {
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<script setup lang="ts">
|
||||
import MobilePlanLoadSection from '@/views/m/pl/plan/MobilePlanLoadSection.vue'
|
||||
import { Plus, Search } from '@element-plus/icons-vue'
|
||||
import { fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { fetchCustomerDetail, fetchCustomerOptions } from '@/api/crm/customer'
|
||||
import { customerStopPrefApi, type CustomerStopPref } from '@/api/pl/index'
|
||||
import PlAddressWithLibrary, {
|
||||
type PlAddressApplyPayload
|
||||
@@ -189,6 +189,7 @@
|
||||
} from '@/utils/pl-plan-contract-product'
|
||||
import {
|
||||
canManualToggleStopDibang,
|
||||
resolveCustomerSameCityFlag,
|
||||
resolveStopDibangDefaults,
|
||||
type PlanLoadForm
|
||||
} from '@/utils/pl-plan-stop-form'
|
||||
@@ -232,6 +233,7 @@
|
||||
id: string
|
||||
customerName: string
|
||||
customerNo?: string
|
||||
sameCity?: number
|
||||
}
|
||||
|
||||
const customerOptions = ref<CustomerOptionRow[]>([])
|
||||
@@ -402,6 +404,7 @@
|
||||
products: [],
|
||||
generateDibang: 0,
|
||||
dibangDirection: 'none',
|
||||
sameCity: 0,
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
@@ -427,15 +430,29 @@
|
||||
products: [],
|
||||
generateDibang: defaults.generateDibang,
|
||||
dibangDirection: defaults.dibangDirection,
|
||||
sameCity: resolveCustomerSameCityFlag(customer?.sameCity),
|
||||
address: '',
|
||||
lng: null,
|
||||
lat: null,
|
||||
contact: '',
|
||||
notes: ''
|
||||
})
|
||||
void applySameCityFromCustomer(String(customerId))
|
||||
void applyStopPrefFromCustomer(String(customerId))
|
||||
}
|
||||
|
||||
async function applySameCityFromCustomer(customerId: string) {
|
||||
try {
|
||||
const res = await fetchCustomerDetail({ id: customerId })
|
||||
const data = pickBxData<{ sameCity?: number }>(res)
|
||||
if (!data) return
|
||||
if (String(props.modelValue.customerId) !== String(customerId)) return
|
||||
patch({ sameCity: resolveCustomerSameCityFlag(data.sameCity) })
|
||||
} catch {
|
||||
// 静默:不阻断选客户
|
||||
}
|
||||
}
|
||||
|
||||
async function applyStopPrefFromCustomer(customerId: string) {
|
||||
try {
|
||||
const res = await customerStopPrefApi.get({ customerId, stopType: 'load' })
|
||||
|
||||
Reference in new issue
Block a user