ERP:基本完成采购订单 100%

This commit is contained in:
YunaiV 2024-02-12 10:00:09 +08:00
parent 600892b112
commit 5339cca40e
8 changed files with 43 additions and 63 deletions

View File

@ -26,16 +26,16 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户" prop="customerId">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="formData.customerId"
v-model="formData.supplierId"
clearable
filterable
placeholder="请选择客户"
placeholder="请选择供应商"
class="!w-1/1"
>
<el-option
v-for="item in customerList"
v-for="item in supplierList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -43,24 +43,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销售人员" prop="saleUserId">
<el-select
v-model="formData.saleUserId"
clearable
filterable
placeholder="请选择销售人员"
class="!w-1/1"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="备注" prop="remark">
<el-input
@ -81,7 +63,7 @@
<ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane label="订单产品清单" name="item">
<SaleOrderItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
<PurchaseOrderItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
</el-tab-pane>
</el-tabs>
</ContentWrap>
@ -131,13 +113,13 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="收取订金" prop="depositPrice">
<el-form-item label="支付订金" prop="depositPrice">
<el-input-number
v-model="formData.depositPrice"
controls-position="right"
:min="0"
:precision="2"
placeholder="请输入收取订金"
placeholder="请输入支付订金"
class="!w-1/1"
/>
</el-form-item>
@ -153,15 +135,15 @@
</Dialog>
</template>
<script setup lang="ts">
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
import SaleOrderItemForm from './components/SaleOrderItemForm.vue'
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
import { PurchaseOrderApi, PurchaseOrderVO } from '@/api/erp/purchase/order'
import PurchaseOrderItemForm from './components/PurchaseOrderItemForm.vue'
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils'
import * as UserApi from '@/api/system/user'
import { AccountApi, AccountVO } from '@/api/erp/finance/account'
/** ERP 销售订单表单 */
defineOptions({ name: 'SaleOrderForm' })
defineOptions({ name: 'PurchaseOrderForm' })
const { t } = useI18n() //
const message = useMessage() //
@ -172,9 +154,8 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update - detail -
const formData = ref({
id: undefined,
customerId: undefined,
supplierId: undefined,
accountId: undefined,
saleUserId: undefined,
orderTime: undefined,
remark: undefined,
fileUrl: '',
@ -186,12 +167,12 @@ const formData = ref({
no: undefined //
})
const formRules = reactive({
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
supplierId: [{ required: true, message: '供应商不能为空', trigger: 'blur' }],
orderTime: [{ required: true, message: '订单时间不能为空', trigger: 'blur' }]
})
const disabled = computed(() => formType.value === 'detail')
const formRef = ref() // Ref
const customerList = ref<CustomerVO[]>([]) //
const supplierList = ref<SupplierVO[]>([]) //
const accountList = ref<AccountVO[]>([]) //
const userList = ref<UserApi.UserVO[]>([]) //
@ -225,13 +206,13 @@ const open = async (type: string, id?: number) => {
if (id) {
formLoading.value = true
try {
formData.value = await SaleOrderApi.getSaleOrder(id)
formData.value = await PurchaseOrderApi.getPurchaseOrder(id)
} finally {
formLoading.value = false
}
}
//
customerList.value = await CustomerApi.getCustomerSimpleList()
//
supplierList.value = await SupplierApi.getSupplierSimpleList()
//
userList.value = await UserApi.getSimpleUserList()
//
@ -252,12 +233,12 @@ const submitForm = async () => {
//
formLoading.value = true
try {
const data = formData.value as unknown as SaleOrderVO
const data = formData.value as unknown as PurchaseOrderVO
if (formType.value === 'create') {
await SaleOrderApi.createSaleOrder(data)
await PurchaseOrderApi.createPurchaseOrder(data)
message.success(t('common.createSuccess'))
} else {
await SaleOrderApi.updateSaleOrder(data)
await PurchaseOrderApi.updatePurchaseOrder(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
@ -272,9 +253,8 @@ const submitForm = async () => {
const resetForm = () => {
formData.value = {
id: undefined,
customerId: undefined,
supplierId: undefined,
accountId: undefined,
saleUserId: undefined,
orderTime: undefined,
remark: undefined,
fileUrl: undefined,

View File

@ -94,7 +94,7 @@
<el-input-number
v-model="row.taxPercent"
controls-position="right"
:min="0.01"
:min="0"
:precision="2"
class="!w-100%"
/>
@ -132,7 +132,7 @@
</el-table>
</el-form>
<el-row justify="center" class="mt-3" v-if="!disabled">
<el-button @click="handleAdd" round>+ 添加入库产品</el-button>
<el-button @click="handleAdd" round>+ 添加采购产品</el-button>
</el-row>
</template>
<script setup lang="ts">
@ -239,7 +239,7 @@ const onChangeProduct = (productId, row) => {
if (product) {
row.productUnitName = product.unitName
row.productBarCode = product.barCode
row.productPrice = product.salePrice
row.productPrice = product.purchasePrice
}
//
setStockCount(row)

View File

@ -125,14 +125,14 @@
<script lang="ts" setup>
import { ElTable } from 'element-plus'
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
import { PurchaseOrderApi, PurchaseOrderVO } from '@/api/erp/purchase/order'
import { dateFormatter2 } from '@/utils/formatTime'
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
import { ProductApi, ProductVO } from '@/api/erp/product/product'
defineOptions({ name: 'ErpSaleOrderOutEnableList' })
defineOptions({ name: 'ErpPurchaseOrderOutEnableList' })
const list = ref<SaleOrderVO[]>([]) //
const list = ref<PurchaseOrderVO[]>([]) //
const total = ref(0) //
const loading = ref(false) //
const dialogVisible = ref(false) //
@ -167,7 +167,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交选择 */
const emits = defineEmits<{
(e: 'success', value: SaleOrderVO): void
(e: 'success', value: PurchaseOrderVO): void
}>()
const submitForm = () => {
try {
@ -182,7 +182,7 @@ const submitForm = () => {
const getList = async () => {
loading.value = true
try {
const data = await SaleOrderApi.getSaleOrderPage(queryParams)
const data = await PurchaseOrderApi.getPurchaseOrderPage(queryParams)
list.value = data.list
total.value = data.total
} finally {

View File

@ -131,14 +131,14 @@
<script lang="ts" setup>
import { ElTable } from 'element-plus'
import { SaleOrderApi, SaleOrderVO } from '@/api/erp/sale/order'
import { PurchaseOrderApi, PurchaseOrderVO } from '@/api/erp/purchase/order'
import { dateFormatter2 } from '@/utils/formatTime'
import { erpCountTableColumnFormatter, erpPriceTableColumnFormatter } from '@/utils'
import { ProductApi, ProductVO } from '@/api/erp/product/product'
defineOptions({ name: 'SaleOrderReturnEnableList' })
defineOptions({ name: 'PurchaseOrderReturnEnableList' })
const list = ref<SaleOrderVO[]>([]) //
const list = ref<PurchaseOrderVO[]>([]) //
const total = ref(0) //
const loading = ref(false) //
const dialogVisible = ref(false) //
@ -173,7 +173,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交选择 */
const emits = defineEmits<{
(e: 'success', value: SaleOrderVO): void
(e: 'success', value: PurchaseOrderVO): void
}>()
const submitForm = () => {
try {
@ -188,7 +188,7 @@ const submitForm = () => {
const getList = async () => {
loading.value = true
try {
const data = await SaleOrderApi.getSaleOrderPage(queryParams)
const data = await PurchaseOrderApi.getPurchaseOrderPage(queryParams)
list.value = data.list
total.value = data.total
} finally {

View File

@ -182,7 +182,7 @@
<el-table-column
label="入库数量"
align="center"
prop="outCount"
prop="inCount"
:formatter="erpCountTableColumnFormatter"
/>
<el-table-column
@ -204,7 +204,7 @@
:formatter="erpPriceTableColumnFormatter"
/>
<el-table-column
label="收取订金"
label="支付订金"
align="center"
prop="depositPrice"
:formatter="erpPriceTableColumnFormatter"
@ -271,7 +271,7 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<!-- <PurchaseOrderForm ref="formRef" @success="getList" />-->
<PurchaseOrderForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
@ -279,7 +279,7 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import { PurchaseOrderApi, PurchaseOrderVO } from '@/api/erp/purchase/order'
// import PurchaseOrderForm from './PurchaseOrderForm.vue'
import PurchaseOrderForm from './PurchaseOrderForm.vue'
import { ProductApi, ProductVO } from '@/api/erp/product/product'
import { UserVO } from '@/api/system/user'
import * as UserApi from '@/api/system/user'

View File

@ -94,7 +94,7 @@
<el-input-number
v-model="row.taxPercent"
controls-position="right"
:min="0.01"
:min="0"
:precision="2"
class="!w-100%"
/>
@ -132,7 +132,7 @@
</el-table>
</el-form>
<el-row justify="center" class="mt-3" v-if="!disabled">
<el-button @click="handleAdd" round>+ 添加出库产品</el-button>
<el-button @click="handleAdd" round>+ 添加采购产品</el-button>
</el-row>
</template>
<script setup lang="ts">

View File

@ -129,7 +129,7 @@
<el-input-number
v-model="row.taxPercent"
controls-position="right"
:min="0.01"
:min="0"
:precision="2"
class="!w-100%"
/>

View File

@ -129,7 +129,7 @@
<el-input-number
v-model="row.taxPercent"
controls-position="right"
:min="0.01"
:min="0"
:precision="2"
class="!w-100%"
/>