parent
0bd46a118a
commit
b89471d43e
@ -152,7 +152,6 @@ const props = defineProps<{
|
|||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formData = ref([])
|
const formData = ref([])
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }],
|
|
||||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||||
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
@ -186,7 +186,6 @@ const props = defineProps<{
|
|||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formData = ref([])
|
const formData = ref([])
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }],
|
|
||||||
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }],
|
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }],
|
||||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||||
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
||||||
|
@ -10,17 +10,17 @@
|
|||||||
>
|
>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="出库单号" prop="no">
|
<el-form-item label="退货单号" prop="no">
|
||||||
<el-input disabled v-model="formData.no" placeholder="保存时自动生成" />
|
<el-input disabled v-model="formData.no" placeholder="保存时自动生成" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="出库时间" prop="outTime">
|
<el-form-item label="退货时间" prop="outTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formData.outTime"
|
v-model="formData.returnTime"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="x"
|
value-format="x"
|
||||||
placeholder="选择出库时间"
|
placeholder="选择退货时间"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<el-form-item label="关联订单" prop="orderNo">
|
<el-form-item label="关联订单" prop="orderNo">
|
||||||
<el-input v-model="formData.orderNo" readonly>
|
<el-input v-model="formData.orderNo" readonly>
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button @click="openSaleOrderOutEnableList">
|
<el-button @click="openSaleOrderReturnEnableList">
|
||||||
<Icon icon="ep:search" /> 选择
|
<Icon icon="ep:search" /> 选择
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -91,8 +91,8 @@
|
|||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
|
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
|
||||||
<el-tab-pane label="出库产品清单" name="item">
|
<el-tab-pane label="退货产品清单" name="item">
|
||||||
<SaleOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
|
<SaleReturnItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
@ -110,7 +110,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="收款优惠" prop="discountPrice">
|
<el-form-item label="退款优惠" prop="discountPrice">
|
||||||
<el-input
|
<el-input
|
||||||
disabled
|
disabled
|
||||||
v-model="formData.discountPrice"
|
v-model="formData.discountPrice"
|
||||||
@ -154,13 +154,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="本次收款" prop="payPrice">
|
<el-form-item label="本次退款" prop="refundPrice">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.payPrice"
|
v-model="formData.refundPrice"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="2"
|
:precision="2"
|
||||||
placeholder="请输入本次收款"
|
placeholder="请输入本次退款"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -175,21 +175,21 @@
|
|||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<!-- 可出库的订单列表 -->
|
<!-- 可退货的订单列表 -->
|
||||||
<SaleOrderOutEnableList ref="saleOrderOutEnableListRef" @success="handleSaleOrderChange" />
|
<!-- <SaleOrderReturnEnableList ref="saleOrderReturnEnableListRef" @success="handleSaleOrderChange" />-->
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SaleOutApi, SaleOutVO } from '@/api/erp/sale/out'
|
import { SaleReturnApi, SaleReturnVO } from '@/api/erp/sale/return'
|
||||||
import SaleOutItemForm from './components/SaleOutItemForm.vue'
|
import SaleReturnItemForm from './components/SaleReturnItemForm.vue'
|
||||||
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
|
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
|
||||||
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
|
||||||
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
|
||||||
import SaleOrderOutEnableList from '@/views/erp/sale/order/components/SaleOrderOutEnableList.vue'
|
// import SaleOrderReturnEnableList from '@/views/erp/sale/order/components/SaleOrderReturnEnableList.vue'
|
||||||
import { SaleOrderVO } from '@/api/erp/sale/order'
|
import { SaleOrderVO } from '@/api/erp/sale/order'
|
||||||
import * as UserApi from '@/api/system/user'
|
import * as UserApi from '@/api/system/user'
|
||||||
|
|
||||||
/** ERP 销售出库表单 */
|
/** ERP 销售退货表单 */
|
||||||
defineOptions({ name: 'SaleOutForm' })
|
defineOptions({ name: 'SaleReturnForm' })
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -203,22 +203,22 @@ const formData = ref({
|
|||||||
customerId: undefined,
|
customerId: undefined,
|
||||||
accountId: undefined,
|
accountId: undefined,
|
||||||
saleUserId: undefined,
|
saleUserId: undefined,
|
||||||
outTime: undefined,
|
returnTime: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
fileUrl: '',
|
fileUrl: '',
|
||||||
discountPercent: 0,
|
discountPercent: 0,
|
||||||
discountPrice: 0,
|
discountPrice: 0,
|
||||||
totalPrice: 0,
|
totalPrice: 0,
|
||||||
otherPrice: 0,
|
otherPrice: 0,
|
||||||
payPrice: undefined,
|
refundPrice: undefined,
|
||||||
orderNo: undefined,
|
orderNo: undefined,
|
||||||
items: [],
|
items: [],
|
||||||
no: undefined // 出库单号,后端返回
|
no: undefined // 退货单号,后端返回
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||||
outTime: [{ required: true, message: '出库时间不能为空', trigger: 'blur' }],
|
returnTime: [{ required: true, message: '退货时间不能为空', trigger: 'blur' }],
|
||||||
payPrice: [{ required: true, message: '本次收款不能为空', trigger: 'blur' }]
|
refundPrice: [{ required: true, message: '本次退款不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const disabled = computed(() => formType.value === 'detail')
|
const disabled = computed(() => formType.value === 'detail')
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
@ -242,13 +242,13 @@ watch(
|
|||||||
const discountPrice =
|
const discountPrice =
|
||||||
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
val.discountPercent != null ? erpPriceMultiply(totalPrice, val.discountPercent / 100.0) : 0
|
||||||
// debugger
|
// debugger
|
||||||
// TODO 芋艿:payPrice 自动计算会有问题,界面上看到修改了,传递到后端还是没改过来
|
// TODO 芋艿:refundPrice 自动计算会有问题,界面上看到修改了,传递到后端还是没改过来
|
||||||
// const payPrice = totalPrice - discountPrice + val.otherPrice
|
// const refundPrice = totalPrice - discountPrice + val.otherPrice
|
||||||
// 赋值
|
// 赋值
|
||||||
formData.value.discountPrice = discountPrice
|
formData.value.discountPrice = discountPrice
|
||||||
formData.value.totalPrice = totalPrice - discountPrice
|
formData.value.totalPrice = totalPrice - discountPrice
|
||||||
// val.payPrice = payPrice
|
// val.refundPrice = refundPrice
|
||||||
// formData.value.payPrice = payPrice
|
// formData.value.refundPrice = refundPrice
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
)
|
)
|
||||||
@ -263,7 +263,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await SaleOutApi.getSaleOut(id)
|
formData.value = await SaleReturnApi.getSaleReturn(id)
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@ -281,14 +281,14 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
/** 打开【可出库的订单列表】弹窗 */
|
/** 打开【可退货的订单列表】弹窗 */
|
||||||
const saleOrderOutEnableListRef = ref() // 可出库的订单列表 Ref
|
const saleOrderReturnEnableListRef = ref() // 可退货的订单列表 Ref
|
||||||
const openSaleOrderOutEnableList = () => {
|
const openSaleOrderReturnEnableList = () => {
|
||||||
saleOrderOutEnableListRef.value.open()
|
saleOrderReturnEnableListRef.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSaleOrderChange = (order: SaleOrderVO) => {
|
const handleSaleOrderChange = (order: SaleOrderVO) => {
|
||||||
// 将订单设置到出库单
|
// 将订单设置到退货单
|
||||||
formData.value.orderId = order.id
|
formData.value.orderId = order.id
|
||||||
formData.value.orderNo = order.no
|
formData.value.orderNo = order.no
|
||||||
formData.value.customerId = order.customerId
|
formData.value.customerId = order.customerId
|
||||||
@ -297,10 +297,10 @@ const handleSaleOrderChange = (order: SaleOrderVO) => {
|
|||||||
formData.value.discountPercent = order.discountPercent
|
formData.value.discountPercent = order.discountPercent
|
||||||
formData.value.remark = order.remark
|
formData.value.remark = order.remark
|
||||||
formData.value.fileUrl = order.fileUrl
|
formData.value.fileUrl = order.fileUrl
|
||||||
// 将订单项设置到出库单项
|
// 将订单项设置到退货单项
|
||||||
order.items.forEach((item) => {
|
order.items.forEach((item) => {
|
||||||
item.totalCount = item.count
|
item.totalCount = item.count
|
||||||
item.count = item.totalCount - item.outCount
|
item.count = item.totalCount - item.returnCount
|
||||||
item.orderItemId = item.id
|
item.orderItemId = item.id
|
||||||
item.id = undefined
|
item.id = undefined
|
||||||
})
|
})
|
||||||
@ -316,12 +316,12 @@ const submitForm = async () => {
|
|||||||
// 提交请求
|
// 提交请求
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = formData.value as unknown as SaleOutVO
|
const data = formData.value as unknown as SaleReturnVO
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await SaleOutApi.createSaleOut(data)
|
await SaleReturnApi.createSaleReturn(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await SaleOutApi.updateSaleOut(data)
|
await SaleReturnApi.updateSaleReturn(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
@ -339,14 +339,14 @@ const resetForm = () => {
|
|||||||
customerId: undefined,
|
customerId: undefined,
|
||||||
accountId: undefined,
|
accountId: undefined,
|
||||||
saleUserId: undefined,
|
saleUserId: undefined,
|
||||||
outTime: undefined,
|
returnTime: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
fileUrl: undefined,
|
fileUrl: undefined,
|
||||||
discountPercent: 0,
|
discountPercent: 0,
|
||||||
discountPrice: 0,
|
discountPrice: 0,
|
||||||
totalPrice: 0,
|
totalPrice: 0,
|
||||||
otherPrice: 0,
|
otherPrice: 0,
|
||||||
payPrice: undefined,
|
refundPrice: undefined,
|
||||||
items: []
|
items: []
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
@ -186,7 +186,6 @@ const props = defineProps<{
|
|||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formData = ref([])
|
const formData = ref([])
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }],
|
|
||||||
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }],
|
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }],
|
||||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||||
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
count: [{ required: true, message: '产品数量不能为空', trigger: 'blur' }]
|
@ -287,7 +287,7 @@
|
|||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<SaleOutForm ref="formRef" @success="getList" />
|
<SaleReturnForm ref="formRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
Loading…
Reference in New Issue
Block a user