From 33c57d232811acf72bfa6202bb0b9a670712b4de Mon Sep 17 00:00:00 2001 From: zy Date: Mon, 28 Apr 2025 17:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 2 +- src/router/modules/remaining.ts | 22 +++++ src/utils/dict.ts | 3 + .../crm/billtemplate/BillTemplateForm.vue | 88 ++++++++----------- .../crm/billtemplate/components/index.vue | 49 ++++++----- src/views/crm/billtemplate/index.vue | 19 ++-- src/views/crm/business/BusinessForm.vue | 43 ++++++--- .../crm/business/components/BusinessList.vue | 6 +- src/views/crm/business/index.vue | 3 + .../companyInfo/changerecorddata/index.vue | 2 + .../companyInfo/companyabnormalinfo/index.vue | 2 + .../companyInfo/companybranchinfo/index.vue | 2 + .../companyInfo/companycourtinfo/index.vue | 2 + .../companyjudgmentdebtorinfo/index.vue | 2 + .../companyInfo/companylawsuitinfo/index.vue | 2 + .../detail/companyInfo/employeedata/index.vue | 2 + .../detail/companyInfo/partnerdata/index.vue | 3 + 17 files changed, 156 insertions(+), 96 deletions(-) diff --git a/.env.local b/.env.local index 35765584d..925808d83 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://localhost:48080' +VITE_BASE_URL='http://172.22.3.6:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 31c074ef7..4ecc6fde9 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -534,6 +534,28 @@ const remainingRouter: AppRouteRecordRaw[] = [ }, component: () => import('@/views/crm/business/detail/index.vue') }, + { + path: 'business/bill-templete-add', + name: 'BillTempleteAdd', + meta: { + title: '票据模版新增', + noCache: true, + hidden: true, + activeMenu: '/crm/business' + }, + component: () => import('@/views/crm/billtemplate/BillTemplateForm.vue') + }, + { + path: 'business/bill-templete-edit', + name: 'BillTempleteEdit', + meta: { + title: '票据模版编辑', + noCache: true, + hidden: true, + activeMenu: '/crm/business' + }, + component: () => import('@/views/crm/billtemplate/BillTemplateForm.vue') + }, { path: 'business/add', name: 'CrmBusinessAdd', diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 35c95077b..37cbdb119 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -226,6 +226,9 @@ export enum DICT_TYPE { CRM_COMPLAINT_METHOD = "crm_complaint_method", // 投诉方式 CRM_COMPLAINT_LEVEL = "crm_complaint_level", // 投诉级别 + // 商机账期 + PAYMENT_TERM = "payment_term", // 投诉级别 + // ========== ERP - 企业资源计划模块 ========== ERP_AUDIT_STATUS = 'erp_audit_status', // ERP 审批状态 diff --git a/src/views/crm/billtemplate/BillTemplateForm.vue b/src/views/crm/billtemplate/BillTemplateForm.vue index a1d2747a0..e54cc5066 100644 --- a/src/views/crm/billtemplate/BillTemplateForm.vue +++ b/src/views/crm/billtemplate/BillTemplateForm.vue @@ -1,5 +1,5 @@ diff --git a/src/views/crm/billtemplate/components/index.vue b/src/views/crm/billtemplate/components/index.vue index a2bc92e83..2722480aa 100644 --- a/src/views/crm/billtemplate/components/index.vue +++ b/src/views/crm/billtemplate/components/index.vue @@ -10,7 +10,7 @@ > - + - + @@ -128,28 +128,29 @@ watch( { immediate: true } ) -/** 监听合同产品变化,计算合同产品总价 */ -watch( - () => formData.value, - (val) => { - if (!val || val.length === 0) { - return - } - // 循环处理 - val.forEach((item) => { - if (item.offlinePrice != null && item.onlinePrice != null) { - item.totalPrice = item.offlinePrice + item.onlinePrice - } else { - item.totalPrice = 0 - } - }) - }, - { deep: true } -) - +const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const getList = (val: []) => { - formData.value = val - + console.log('%csrc/views/crm/billtemplate/components/index.vue:133 object', 'color: #007acc;', formData.value); + for(let i = formData.value.length - 1; i >= 0; i--) { + let obj = formData.value[i] + if(!val.some(v => v.id === obj.productId)) formData.value.splice(i, 1) + } + val.forEach(item => { + if(!formData.value.some(v => v.productId === item.id)) { + formData.value.push({ + "productId": item.id, + "category": item.category, + "productName": item.name, + "detailType": item.detailType, + "productUnit": item.unit, + "onlinePrice": '', + "offlinePrice": '', + "count": '' + }) + } + }) + emit('success', formData.value) + } // /** 新增按钮操作 */ diff --git a/src/views/crm/billtemplate/index.vue b/src/views/crm/billtemplate/index.vue index 41b17b61e..44d387dd5 100644 --- a/src/views/crm/billtemplate/index.vue +++ b/src/views/crm/billtemplate/index.vue @@ -49,7 +49,7 @@ 新增 @@ -90,7 +90,7 @@ 编辑 @@ -115,8 +115,6 @@ /> - - diff --git a/src/views/crm/business/BusinessForm.vue b/src/views/crm/business/BusinessForm.vue index 98f91d05c..58f1c14d3 100644 --- a/src/views/crm/business/BusinessForm.vue +++ b/src/views/crm/business/BusinessForm.vue @@ -121,9 +121,9 @@ - + - + + - + - + {{ dict.label }} @@ -222,8 +223,10 @@ - 确 定 - 取 消 +
+ 确 定 + 取 消 +
@@ -239,6 +242,7 @@ import { useUserStore } from '@/store/modules/user'; import { defaultProps, handleTree } from '@/utils/tree'; import BusinessProductForm from './components/BusinessProductForm.vue'; import { erpPriceMultiply, erpPriceInputFormatter } from '@/utils'; +import { number } from 'vue-types'; const { proxy }: any = getCurrentInstance(); const { t } = useI18n(); @@ -316,12 +320,21 @@ watch( { deep: true } ); +watch( + () => formData.value.totalPrice, + (newProducts) => { + console.log('%csrc/views/crm/business/BusinessForm.vue:326 111', 'color: #007acc;', 111); + formData.value.creditLimit = parseInt(newProducts / 365 * formData.value.creditCalcCycle) + + }, + { deep: true } +); + const open = async (id?: number, customerId?: number) => { if (id) { formLoading.value = true; try { const data = await BusinessApi.getBusiness(id); - console.log('%csrc/views/crm/business/BusinessForm.vue:325 data', 'color: #007acc;', data); formData.value = { ...data, products: data.products || [] @@ -345,6 +358,15 @@ const setList = (newProducts) => { formData.value.products = newProducts; }; +// 改版账期 +const changePayment = (val) => { + +const currentDate = new Date(); // 获取当前日期 +const currentMonth = currentDate.getMonth() + 1; // 获取当前月份(注意月份是从0开始的,所以需要加1) +const daysInMonth = new Date(currentDate.getFullYear(), currentMonth, 0).getDate(); // 获取指定月份的天数 + formData.value.creditCalcCycle = (val > 2 ? parseInt(daysInMonth + Number(val)) : 0) + formData.value.creditLimit = parseInt(formData.value.totalPrice / 365 * formData.value.creditCalcCycle) +} const { push } = useRouter() const submitForm = async () => { @@ -392,6 +414,7 @@ const resetForm = () => { const route = useRoute(); onMounted(async () => { + console.log('%csrc/views/crm/business/BusinessForm.vue:406 getStrDictOptions(DICT_TYPE.PAYMENT_TERM)', 'color: #007acc;', getStrDictOptions(DICT_TYPE.PAYMENT_TERM)); const customerId = route.query.customerId; formType.value = route.query.id; if (formType.value) open(formType.value, customerId) diff --git a/src/views/crm/business/components/BusinessList.vue b/src/views/crm/business/components/BusinessList.vue index f990606ec..811341f7d 100644 --- a/src/views/crm/business/components/BusinessList.vue +++ b/src/views/crm/business/components/BusinessList.vue @@ -57,8 +57,6 @@ /> - - { } /** 添加操作 */ +const { push } = useRouter() const formRef = ref() const openForm = () => { - formRef.value.open('create', null, props.customerId, props.contactId) + push({ name: 'CrmBusinessAdd' }) } /** 打开联系人详情 */ -const { push } = useRouter() const openDetail = (id: number) => { push({ name: 'CrmBusinessDetail', params: { id } }) } diff --git a/src/views/crm/business/index.vue b/src/views/crm/business/index.vue index 3edd7ee15..fc02d2c54 100644 --- a/src/views/crm/business/index.vue +++ b/src/views/crm/business/index.vue @@ -272,4 +272,7 @@ const handleExport = async () => { onMounted(() => { getList() }) +onActivated(()=>{ + getList() +}) diff --git a/src/views/crm/customer/detail/companyInfo/changerecorddata/index.vue b/src/views/crm/customer/detail/companyInfo/changerecorddata/index.vue index c9b80b1df..47770a2b7 100644 --- a/src/views/crm/customer/detail/companyInfo/changerecorddata/index.vue +++ b/src/views/crm/customer/detail/companyInfo/changerecorddata/index.vue @@ -45,7 +45,9 @@ const getList = async () => { /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/companyabnormalinfo/index.vue b/src/views/crm/customer/detail/companyInfo/companyabnormalinfo/index.vue index 23b9a41c4..5933121c8 100644 --- a/src/views/crm/customer/detail/companyInfo/companyabnormalinfo/index.vue +++ b/src/views/crm/customer/detail/companyInfo/companyabnormalinfo/index.vue @@ -47,7 +47,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/companybranchinfo/index.vue b/src/views/crm/customer/detail/companyInfo/companybranchinfo/index.vue index f0ea79447..6619c9c42 100644 --- a/src/views/crm/customer/detail/companyInfo/companybranchinfo/index.vue +++ b/src/views/crm/customer/detail/companyInfo/companybranchinfo/index.vue @@ -42,7 +42,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/companycourtinfo/index.vue b/src/views/crm/customer/detail/companyInfo/companycourtinfo/index.vue index 6c1e2d117..4208bd4a9 100644 --- a/src/views/crm/customer/detail/companyInfo/companycourtinfo/index.vue +++ b/src/views/crm/customer/detail/companyInfo/companycourtinfo/index.vue @@ -45,7 +45,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/companyjudgmentdebtorinfo/index.vue b/src/views/crm/customer/detail/companyInfo/companyjudgmentdebtorinfo/index.vue index 287d0259d..d6f0116c1 100644 --- a/src/views/crm/customer/detail/companyInfo/companyjudgmentdebtorinfo/index.vue +++ b/src/views/crm/customer/detail/companyInfo/companyjudgmentdebtorinfo/index.vue @@ -45,7 +45,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/companylawsuitinfo/index.vue b/src/views/crm/customer/detail/companyInfo/companylawsuitinfo/index.vue index dfbcbfc3f..6f6dcb54a 100644 --- a/src/views/crm/customer/detail/companyInfo/companylawsuitinfo/index.vue +++ b/src/views/crm/customer/detail/companyInfo/companylawsuitinfo/index.vue @@ -46,7 +46,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/employeedata/index.vue b/src/views/crm/customer/detail/companyInfo/employeedata/index.vue index d90055f1b..085b6a845 100644 --- a/src/views/crm/customer/detail/companyInfo/employeedata/index.vue +++ b/src/views/crm/customer/detail/companyInfo/employeedata/index.vue @@ -44,7 +44,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file diff --git a/src/views/crm/customer/detail/companyInfo/partnerdata/index.vue b/src/views/crm/customer/detail/companyInfo/partnerdata/index.vue index d331f6dd6..540329795 100644 --- a/src/views/crm/customer/detail/companyInfo/partnerdata/index.vue +++ b/src/views/crm/customer/detail/companyInfo/partnerdata/index.vue @@ -28,6 +28,7 @@ const total = ref(0) // 列表的总页数 const queryParams = reactive({ pageNo: 1, pageSize: 999, + customerInfoId: '' }) const queryFormRef = ref() // 搜索的表单 const exportLoading = ref(false) // 导出的加载中 @@ -45,7 +46,9 @@ const getList = async () => { } /** 初始化 **/ +const { params } = useRoute() onMounted(() => { + queryParams.customerInfoId = params.id getList() }) \ No newline at end of file