|
|
|
|
@ -97,8 +97,17 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="收货地址" prop="shippingAddress">
|
|
|
|
|
<el-input v-model="form.shippingAddress" placeholder="请输入收货地址" />
|
|
|
|
|
<el-form-item label="客户联系人" prop="customerContactId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="form.customerContactId"
|
|
|
|
|
placeholder="请先选择客户"
|
|
|
|
|
filterable
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
@change="handleCustomerContactChange"
|
|
|
|
|
:disabled="!form.customerId"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in customerContactList" :key="item.contactId" :label="item.contactName" :value="item.contactId" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -111,6 +120,22 @@
|
|
|
|
|
<el-input v-model="form.receiverPhone" placeholder="请输入收货联系电话" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="收货地址" prop="shippingAddress">
|
|
|
|
|
<el-input v-model="form.shippingAddress" placeholder="请输入收货地址" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="发货日期" prop="shippingTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="form.shippingTime"
|
|
|
|
|
type="datetime"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
placeholder="请选择发货日期"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="计划到货时间" prop="planArrivalTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
@ -212,6 +237,7 @@
|
|
|
|
|
:precision="2"
|
|
|
|
|
size="small"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
@change="calculateTotalPrice(scope.row)"
|
|
|
|
|
:disabled="routeParams.type === 'view' || routeParams.type === 'approval'"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
@ -382,6 +408,8 @@ import { listInventoryDetails } from '@/api/wms/inventoryDetails';
|
|
|
|
|
import { InventoryDetailsQuery, InventoryDetailsVO } from '@/api/wms/inventoryDetails/types';
|
|
|
|
|
import { getWmsWarehouseInfoList } from '@/api/wms/warehouseInfo';
|
|
|
|
|
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
|
|
|
|
|
import { getCrmCustomerContactList } from '@/api/oa/crm/customerContact';
|
|
|
|
|
import type { CustomerContactVO } from '@/api/oa/crm/customerContact/types';
|
|
|
|
|
import { getCrmSupplierInfoList } from '@/api/oa/crm/crmSupplierInfo';
|
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule';
|
|
|
|
|
import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
|
|
|
|
|
@ -427,6 +455,7 @@ const materialSourceType = ref('2');
|
|
|
|
|
const customerList = ref<any[]>([]);
|
|
|
|
|
const supplierList = ref<any[]>([]);
|
|
|
|
|
const warehouseList = ref<any[]>([]);
|
|
|
|
|
const customerContactList = ref<CustomerContactVO[]>([]); // 客户联系人列表
|
|
|
|
|
|
|
|
|
|
// 项目选择
|
|
|
|
|
const selectedProjectName = ref<string>('');
|
|
|
|
|
@ -477,6 +506,7 @@ const initFormData: WmsShippingBillForm = {
|
|
|
|
|
projectCode: undefined,
|
|
|
|
|
projectName: undefined,
|
|
|
|
|
customerId: undefined,
|
|
|
|
|
customerContactId: undefined,
|
|
|
|
|
customerName: undefined,
|
|
|
|
|
shippingAddress: undefined,
|
|
|
|
|
receiverName: undefined,
|
|
|
|
|
@ -611,14 +641,47 @@ const projectInfoSelectCallBack = (data: ProjectInfoVO[]) => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 客户选择变化 */
|
|
|
|
|
const handleCustomerChange = (customerId: any) => {
|
|
|
|
|
const customer = customerList.value.find((c) => c.customerId === customerId);
|
|
|
|
|
/** 客户选择变化 - 加载对应的客户联系人列表 */
|
|
|
|
|
const handleCustomerChange = async (customerId: any) => {
|
|
|
|
|
const customer = customerList.value.find((c: any) => c.customerId === customerId);
|
|
|
|
|
if (customer) {
|
|
|
|
|
form.value.customerName = customer.customerName;
|
|
|
|
|
form.value.shippingAddress = customer.address;
|
|
|
|
|
form.value.receiverName = customer.contactPerson;
|
|
|
|
|
form.value.receiverPhone = customer.contactPhone;
|
|
|
|
|
// 默认使用CRM客户的详细地址作为收货地址,用户仍可在界面上手动修改
|
|
|
|
|
form.value.shippingAddress = customer.detailedAddress;
|
|
|
|
|
}
|
|
|
|
|
// 清空已选联系人和相关信息
|
|
|
|
|
form.value.customerContactId = undefined;
|
|
|
|
|
form.value.receiverName = undefined;
|
|
|
|
|
form.value.receiverPhone = undefined;
|
|
|
|
|
customerContactList.value = [];
|
|
|
|
|
// 加载客户联系人列表
|
|
|
|
|
if (customerId) {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getCrmCustomerContactList({ customerId });
|
|
|
|
|
customerContactList.value = res.data || [];
|
|
|
|
|
// 默认选择首要联系人(firstFlag='1'或1),若无则选择第一个
|
|
|
|
|
let defaultContact = customerContactList.value.find((c: CustomerContactVO) => c.firstFlag === '1' || c.firstFlag === (1 as any));
|
|
|
|
|
if (!defaultContact && customerContactList.value.length > 0) {
|
|
|
|
|
defaultContact = customerContactList.value[0];
|
|
|
|
|
}
|
|
|
|
|
if (defaultContact) {
|
|
|
|
|
form.value.customerContactId = defaultContact.contactId;
|
|
|
|
|
// 带出收货联系人信息
|
|
|
|
|
form.value.receiverName = defaultContact.contactName;
|
|
|
|
|
form.value.receiverPhone = defaultContact.phoneNumber;
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('加载客户联系人列表失败:', error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 客户联系人选择变化 - 自动带出姓名和电话 */
|
|
|
|
|
const handleCustomerContactChange = (contactId: any) => {
|
|
|
|
|
const contact = customerContactList.value.find((c: CustomerContactVO) => c.contactId === contactId);
|
|
|
|
|
if (contact) {
|
|
|
|
|
form.value.receiverName = contact.contactName;
|
|
|
|
|
form.value.receiverPhone = contact.phoneNumber;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -857,6 +920,16 @@ const loadFormData = async (id: string | number) => {
|
|
|
|
|
if (form.value.shippingCode) {
|
|
|
|
|
isCodeGenerated.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑模式下:如果有客户ID,加载客户联系人列表
|
|
|
|
|
if (form.value.customerId) {
|
|
|
|
|
try {
|
|
|
|
|
const contactRes = await getCrmCustomerContactList({ customerId: form.value.customerId });
|
|
|
|
|
customerContactList.value = contactRes.data || [];
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('加载客户联系人列表失败:', error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('加载表单数据失败:', error);
|
|
|
|
|
}
|
|
|
|
|
|