|
|
@@ -288,12 +288,37 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
+ <!-- 公司开票信息 -->
|
|
|
+ <el-card shadow="never" class="mb-4">
|
|
|
+ <template #header>
|
|
|
+ <div class="flex justify-between items-center">
|
|
|
+ <span class="font-medium">企业开票信息</span>
|
|
|
+ <el-button type="primary" @click="handleAddInvoice">新增</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-table :data="invoiceList" border>
|
|
|
+ <el-table-column type="index" label="序号" align="center" width="60" />
|
|
|
+ <el-table-column label="是否主账号" align="center" prop="isPrimaryAccount" min-width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span>{{ row.isPrimaryAccount === '0' ? '是' : '否' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="开户行名称" align="center" prop="bankName" min-width="180" />
|
|
|
+ <el-table-column label="银行账户" align="center" prop="bankAccount" min-width="180" />
|
|
|
+ <el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button link type="primary" @click="handleEditInvoice(row, $index)">编辑</el-button>
|
|
|
+ <el-button link type="danger" @click="removeInvoice(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-card>
|
|
|
|
|
|
- <!-- 销售信息 -->
|
|
|
+ <!-- 销售信息 --改为 ERP数据-->
|
|
|
<el-card shadow="never" class="mb-4">
|
|
|
<template #header>
|
|
|
<div class="flex justify-between items-center">
|
|
|
- <span class="font-medium">销售信息</span>
|
|
|
+ <span class="font-medium">ERP销售信息</span>
|
|
|
<el-button type="primary" @click="handleSave">保存</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -365,13 +390,13 @@
|
|
|
<el-input v-model="salesForm.creditPaymentPassword" type="password" placeholder="请输入支付密码" show-password />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
+ <!-- <el-col :span="8">
|
|
|
<el-form-item label="收款条件" prop="accountPeriod">
|
|
|
<el-select v-model="salesForm.accountPeriod" placeholder="请选择收款条件" class="w-full" filterable>
|
|
|
<el-option v-for="item in settlementMethodList" :key="item.id" :label="item.settlementName" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="20">
|
|
|
@@ -382,36 +407,68 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户来源" prop="payDays">
|
|
|
+ <el-select v-model="salesForm.customerSource" class="w-full" filterable>
|
|
|
+ <el-option v-for="dict in customer_source" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="销售通路" prop="payDays">
|
|
|
+ <el-select v-model="salesForm.sellChannel" class="w-full" filterable>
|
|
|
+ <el-option v-for="dict in sell_channel" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="税码" prop="rateId">
|
|
|
+ <el-select v-model="salesForm.rateId" placeholder="税码" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in taxrateList" :key="item.id" :label="item.taxrateNo" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="交易币别" prop="dealCurrencyId">
|
|
|
+ <el-select v-model="salesForm.dealCurrencyId" placeholder="请选择交易币别" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in currencyList" :key="item.id" :label="item.currencyName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="账款归属" prop="payDays">
|
|
|
+ <el-input v-model="form.customerNo" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="单价含税" prop="payDays">
|
|
|
+ <el-select v-model="salesForm.unitPrice" placeholder="单价含税" class="w-full" filterable>
|
|
|
+ <el-option v-for="item in unitPriceArr" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="账款额度超限" prop="creditLimit">
|
|
|
+ <el-select v-model="salesForm.creditLimit" placeholder="请选择账款额度超限" class="w-full" filterable>
|
|
|
+ <el-option v-for="dict in erp_is_enabled" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="账款超期" prop="creditTimeLimit">
|
|
|
+ <el-select v-model="salesForm.creditTimeLimit" placeholder="请选择账款超期" class="w-full" filterable>
|
|
|
+ <el-option v-for="dict in erp_is_enabled" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
|
|
|
- <!-- 公司开票信息 -->
|
|
|
- <el-card shadow="never" class="mb-4">
|
|
|
- <template #header>
|
|
|
- <div class="flex justify-between items-center">
|
|
|
- <span class="font-medium">企业开票信息</span>
|
|
|
- <el-button type="primary" @click="handleAddInvoice">新增</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <el-table :data="invoiceList" border>
|
|
|
- <el-table-column type="index" label="序号" align="center" width="60" />
|
|
|
- <el-table-column label="是否主账号" align="center" prop="isPrimaryAccount" min-width="120">
|
|
|
- <template #default="{ row }">
|
|
|
- <span>{{ row.isPrimaryAccount === '0' ? '是' : '否' }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="开户行名称" align="center" prop="bankName" min-width="180" />
|
|
|
- <el-table-column label="银行账户" align="center" prop="bankAccount" min-width="180" />
|
|
|
- <el-table-column label="操作" align="center" width="150" fixed="right">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-button link type="primary" @click="handleEditInvoice(row, $index)">编辑</el-button>
|
|
|
- <el-button link type="danger" @click="removeInvoice(row)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-card>
|
|
|
-
|
|
|
<!-- 添加/编辑开票信息对话框 -->
|
|
|
<add-invoice-dialog v-model="invoiceDialogVisible" :edit-data="currentInvoice" @confirm="handleInvoiceConfirm" />
|
|
|
|
|
|
@@ -454,14 +511,22 @@ import type { InvoiceTypeVO } from '@/api/customer/invoiceType/types';
|
|
|
import { listCompany } from '@/api/company/company';
|
|
|
import { CompanyVO } from '@/api/company/company/types';
|
|
|
import { listComStaff } from '@/api/company/comStaff';
|
|
|
+import { listErpStaff } from '@/api/erpData/erpStaff';
|
|
|
import { ComStaffVO, ComStaffQuery } from '@/api/company/comStaff/types';
|
|
|
+import { ErpStaffVO } from '@/api/erpData/erpStaff/types';
|
|
|
import { listDept, getDept } from '@/api/system/dept';
|
|
|
import { DeptVO } from '@/api/system/dept/types';
|
|
|
+import { listErpDept, getErpDept } from '@/api/erpData/erpDept';
|
|
|
+import { ErpDeptVO } from '@/api/erpData/erpDept/types';
|
|
|
import FileSelector from '@/components/FileSelector/index.vue';
|
|
|
import { Plus, Delete } from '@element-plus/icons-vue';
|
|
|
-
|
|
|
+import { listComCurrency } from '@/api/company/comCurrency';
|
|
|
+import { listTaxrate } from '@/api/company/taxrate';
|
|
|
+import { ComCurrencyVO } from '@/api/company/comCurrency/types';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-const { order_check_way, customer_type, customer_level } = toRefs<any>(proxy?.useDict('order_check_way', 'customer_type', 'customer_level'));
|
|
|
+const { order_check_way, customer_type, customer_level, customer_source, sell_channel, erp_is_enabled } = toRefs<any>(
|
|
|
+ proxy?.useDict('order_check_way', 'customer_type', 'customer_level', 'customer_source', 'sell_channel', 'erp_is_enabled')
|
|
|
+);
|
|
|
// 接收父组件传递的props
|
|
|
const props = defineProps<{
|
|
|
customerId?: string | number;
|
|
|
@@ -470,6 +535,10 @@ const props = defineProps<{
|
|
|
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
+const unitPriceArr = ref([
|
|
|
+ { label: '含税', value: 'True' },
|
|
|
+ { label: '不含税', value: 'False' }
|
|
|
+]);
|
|
|
|
|
|
const formRef = ref<any>(null);
|
|
|
const salesFormRef = ref<any>(null);
|
|
|
@@ -487,9 +556,10 @@ const settlementMethodList = ref<SettlementMethodVO[]>([]);
|
|
|
const creditLevelList = ref<CreditLevelVO[]>([]);
|
|
|
const customerLevelList = ref<CustomerLevelVO[]>([]);
|
|
|
const customerTypeList = ref<CustomerTypeVO[]>([]);
|
|
|
-const comStaffList = ref<ComStaffVO[]>([]);
|
|
|
-const comDeptList = ref<DeptVO[]>([]);
|
|
|
-
|
|
|
+const comStaffList = ref<ErpStaffVO[]>([]);
|
|
|
+const comDeptList = ref<ErpDeptVO[]>([]);
|
|
|
+const currencyList = ref<ComCurrencyVO[]>([]);
|
|
|
+const taxrateList = ref<any[]>([]);
|
|
|
// 企业基本信息(用于显示)
|
|
|
const customerInfo = reactive<any>({
|
|
|
customerNo: '',
|
|
|
@@ -570,6 +640,12 @@ const salesForm = reactive<SalesInfoForm>({
|
|
|
creditPaymentPassword: '',
|
|
|
accountPeriod: '',
|
|
|
payDays: undefined,
|
|
|
+ customerSource: '1',
|
|
|
+ unitPrice: 'True',
|
|
|
+ sellChannel: '1',
|
|
|
+ creditLimit: '1',
|
|
|
+ creditTimeLimit: '1',
|
|
|
+ dealCurrencyId: undefined,
|
|
|
status: '0'
|
|
|
});
|
|
|
|
|
|
@@ -617,6 +693,33 @@ const salesRules = {
|
|
|
serviceStaffId: [{ required: true, message: '请选择客服人员', trigger: 'change' }]
|
|
|
};
|
|
|
|
|
|
+// 加载币种列表
|
|
|
+const loadCurrencyList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listComCurrency({
|
|
|
+ isShow: '0',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000
|
|
|
+ });
|
|
|
+ currencyList.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载币种列表失败:', error);
|
|
|
+ currencyList.value = [];
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 加载税码列表
|
|
|
+const loadTaxrateList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listTaxrate({
|
|
|
+ isShow: '0',
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000
|
|
|
+ });
|
|
|
+ taxrateList.value = res.rows || [];
|
|
|
+ } catch (error) {}
|
|
|
+};
|
|
|
+
|
|
|
// 初始化
|
|
|
onMounted(async () => {
|
|
|
// 加载下拉框数据
|
|
|
@@ -630,6 +733,8 @@ onMounted(async () => {
|
|
|
await loadCustomerTypeList();
|
|
|
await loadComStaffList();
|
|
|
await loadComDeptList();
|
|
|
+ await loadCurrencyList();
|
|
|
+ await loadTaxrateList();
|
|
|
|
|
|
// 优先使用props传递的customerId,否则从路由获取
|
|
|
const id = props.customerId || route.query.id;
|
|
|
@@ -773,8 +878,8 @@ const loadCustomerTypeList = async () => {
|
|
|
// 加载员工列表
|
|
|
const loadComStaffList = async () => {
|
|
|
try {
|
|
|
- const query: any = { status: '0' };
|
|
|
- const res = await listComStaff(query);
|
|
|
+ const query: any = {};
|
|
|
+ const res = await listErpStaff(query);
|
|
|
comStaffList.value = res.rows || [];
|
|
|
} catch (error) {
|
|
|
console.error('加载员工列表失败:', error);
|
|
|
@@ -784,7 +889,7 @@ const loadComStaffList = async () => {
|
|
|
// 加载部门列表
|
|
|
const loadComDeptList = async () => {
|
|
|
try {
|
|
|
- const res = await listDept();
|
|
|
+ const res = await listErpDept();
|
|
|
// 处理可能的不同返回结构
|
|
|
comDeptList.value = res.rows || res.data || [];
|
|
|
} catch (error) {
|
|
|
@@ -842,7 +947,7 @@ const loadCustomerData = async (id: any) => {
|
|
|
const deptExists = comDeptList.value.find((d) => String(d.deptId) === String(salesForm.belongingDepartmentId));
|
|
|
if (!deptExists) {
|
|
|
try {
|
|
|
- const deptRes = await getDept(salesForm.belongingDepartmentId);
|
|
|
+ const deptRes = await getErpDept(salesForm.belongingDepartmentId);
|
|
|
if (deptRes.data) {
|
|
|
comDeptList.value.push(deptRes.data);
|
|
|
}
|
|
|
@@ -914,7 +1019,7 @@ watch(
|
|
|
const res = await getDept(newDeptId);
|
|
|
if (res.data) {
|
|
|
deptName.value = res.data.deptName;
|
|
|
- comDeptList.value.push(res.data);
|
|
|
+ comDeptList.value.push(res.data as any);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('获取部门信息失败:', error);
|
|
|
@@ -972,7 +1077,7 @@ const handleSalesPersonChange = async (staffId: any) => {
|
|
|
try {
|
|
|
const res = await getDept(selectedStaff.deptId);
|
|
|
if (res.data) {
|
|
|
- comDeptList.value.push(res.data);
|
|
|
+ comDeptList.value.push(res.data as any);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('获取部门信息失败:', error);
|