diff --git a/src/api/erp/sale/order/index.ts b/src/api/erp/sale/order/index.ts index 215b5dbd..235ea021 100644 --- a/src/api/erp/sale/order/index.ts +++ b/src/api/erp/sale/order/index.ts @@ -10,7 +10,7 @@ export interface SaleOrderVO { totalPrice: number // 合计金额,单位:元 status: number // 状态 remark: string // 备注 - inCount: number // 销售入库数量 + outCount: number // 销售出库数量 returnCount: number // 销售退货数量 } diff --git a/src/views/erp/sale/order/SaleOrderForm.vue b/src/views/erp/sale/order/SaleOrderForm.vue index fab99f59..30b2b302 100644 --- a/src/views/erp/sale/order/SaleOrderForm.vue +++ b/src/views/erp/sale/order/SaleOrderForm.vue @@ -43,6 +43,24 @@ + + + + + + + formType.value === 'detail') const formRef = ref() // 表单 Ref const customerList = ref([]) // 客户列表 const accountList = ref([]) // 账户列表 +const userList = ref([]) // 用户列表 /** 子表的表单 */ const subTabsName = ref('item') @@ -211,6 +232,8 @@ const open = async (type: string, id?: number) => { } // 加载客户列表 customerList.value = await CustomerApi.getCustomerSimpleList() + // 加载用户列表 + userList.value = await UserApi.getSimpleUserList() // 加载账户列表 accountList.value = await AccountApi.getAccountSimpleList() const defaultAccount = accountList.value.find((item) => item.defaultStatus) @@ -251,6 +274,7 @@ const resetForm = () => { id: undefined, customerId: undefined, accountId: undefined, + saleUserId: undefined, orderTime: undefined, remark: undefined, fileUrl: undefined, diff --git a/src/views/erp/sale/order/components/SaleOrderItemForm.vue b/src/views/erp/sale/order/components/SaleOrderItemForm.vue index 0422dc75..a0cadd5a 100644 --- a/src/views/erp/sale/order/components/SaleOrderItemForm.vue +++ b/src/views/erp/sale/order/components/SaleOrderItemForm.vue @@ -153,7 +153,6 @@ const formLoading = ref(false) // 表单的加载中 const formData = ref([]) const formRules = reactive({ inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }], - warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }], productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }], count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }] }) diff --git a/src/views/erp/sale/order/components/SaleOrderOutEnableList.vue b/src/views/erp/sale/order/components/SaleOrderOutEnableList.vue index c862e73f..55de7459 100644 --- a/src/views/erp/sale/order/components/SaleOrderOutEnableList.vue +++ b/src/views/erp/sale/order/components/SaleOrderOutEnableList.vue @@ -92,7 +92,7 @@ - + + + + + + + + - - - - + + + + - + + + + + + - + @@ -156,6 +186,7 @@ import { AccountApi, AccountVO } from '@/api/erp/finance/account' import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils' import SaleOrderOutEnableList from '@/views/erp/sale/order/components/SaleOrderOutEnableList.vue' import { SaleOrderVO } from '@/api/erp/sale/order' +import * as UserApi from '@/api/system/user' /** ERP 销售出库表单 */ defineOptions({ name: 'SaleOutForm' }) @@ -171,25 +202,29 @@ const formData = ref({ id: undefined, customerId: undefined, accountId: undefined, + saleUserId: undefined, outTime: undefined, remark: undefined, fileUrl: '', discountPercent: 0, discountPrice: 0, totalPrice: 0, - depositPrice: 0, + otherPrice: 0, + payPrice: 0, orderNo: undefined, items: [], no: undefined // 出库单号,后端返回 }) const formRules = reactive({ customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }], - outTime: [{ required: true, message: '出库时间不能为空', trigger: 'blur' }] + outTime: [{ required: true, message: '出库时间不能为空', trigger: 'blur' }], + payPrice: [{ required: true, message: '本次收款不能为空', trigger: 'blur' }] }) const disabled = computed(() => formType.value === 'detail') const formRef = ref() // 表单 Ref const customerList = ref([]) // 客户列表 const accountList = ref([]) // 账户列表 +const userList = ref([]) // 用户列表 /** 子表的表单 */ const subTabsName = ref('item') @@ -202,11 +237,17 @@ watch( if (!val) { return } + // 计算 const totalPrice = val.items.reduce((prev, curr) => prev + curr.totalPrice, 0) const discountPrice = val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0 + // debugger + // TODO 芋艿:这里有问题 + const payPrice = totalPrice - discountPrice + val.otherPrice + // 赋值 formData.value.discountPrice = discountPrice formData.value.totalPrice = totalPrice - discountPrice + formData.value.payPrice = payPrice }, { deep: true } ) @@ -228,15 +269,14 @@ const open = async (type: string, id?: number) => { } // 加载客户列表 customerList.value = await CustomerApi.getCustomerSimpleList() + // 加载用户列表 + userList.value = await UserApi.getSimpleUserList() // 加载账户列表 accountList.value = await AccountApi.getAccountSimpleList() const defaultAccount = accountList.value.find((item) => item.defaultStatus) if (defaultAccount) { formData.value.accountId = defaultAccount.id } - - // TODO 芋艿:单独搞 - // saleOrderOutEnableListRef.value.open() } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -247,18 +287,17 @@ const openSaleOrderOutEnableList = () => { } const handleSaleOrderChange = (order: SaleOrderVO) => { - debugger + // 将订单设置到出库单 + formData.value.orderId = order.id formData.value.orderNo = order.no - // formData.value.customerId = order.customerId - // formData.value.accountId = order.accountId - // formData.value.items = order.items.map((item) => { - // return { - // productId: item.productId, - // count: item.count, - // productPrice: item.productPrice, - // taxPercent: item.taxPercent - // } - // }) + formData.value.customerId = order.customerId + formData.value.accountId = order.accountId + formData.value.saleUserId = order.saleUserId + formData.value.discountPercent = order.discountPercent + formData.value.remark = order.remark + formData.value.fileUrl = order.fileUrl + // 将订单项设置到出库单项 + formData.value.items = order.items.filter((item) => item.count > item.outCount) } /** 提交表单 */ @@ -292,13 +331,15 @@ const resetForm = () => { id: undefined, customerId: undefined, accountId: undefined, + saleUserId: undefined, outTime: undefined, remark: undefined, fileUrl: undefined, discountPercent: 0, discountPrice: 0, totalPrice: 0, - depositPrice: 0, + otherPrice: 0, + payPrice: 0, items: [] } formRef.value?.resetFields() diff --git a/src/views/erp/sale/out/components/SaleOutItemForm.vue b/src/views/erp/sale/out/components/SaleOutItemForm.vue index 0422dc75..c12ceb2c 100644 --- a/src/views/erp/sale/out/components/SaleOutItemForm.vue +++ b/src/views/erp/sale/out/components/SaleOutItemForm.vue @@ -10,18 +10,22 @@ > - + + + + + + + + + +