From 4d7b392b9ccce79e82c25b471c029409b65c63b4 Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Mon, 10 Mar 2025 11:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E3=80=81=E5=85=A5=E5=BA=93=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/psi/outbound_order.ts | 26 +++ src/api/psi/outbound_product.ts | 26 +++ src/api/psi/warehouse_order.ts | 26 +++ src/api/psi/warehouse_product.ts | 26 +++ src/api/psi/warehouse_storege.ts | 12 +- src/views/psi/outbound_order/details.vue | 143 ++++++++++++ src/views/psi/outbound_order/edit.vue | 165 ++++++++++++++ src/views/psi/outbound_order/index.vue | 168 ++++++++++++++ src/views/psi/outbound_product/details.vue | 187 +++++++++++++++ src/views/psi/outbound_product/edit.vue | 238 ++++++++++++++++++++ src/views/psi/outbound_product/index.vue | 174 ++++++++++++++ src/views/psi/warehouse_order/details.vue | 153 +++++++++++++ src/views/psi/warehouse_order/edit.vue | 189 ++++++++++++++++ src/views/psi/warehouse_order/index.vue | 188 ++++++++++++++++ src/views/psi/warehouse_product/details.vue | 187 +++++++++++++++ src/views/psi/warehouse_product/edit.vue | 238 ++++++++++++++++++++ src/views/psi/warehouse_product/index.vue | 174 ++++++++++++++ 17 files changed, 2314 insertions(+), 6 deletions(-) create mode 100644 src/api/psi/outbound_order.ts create mode 100644 src/api/psi/outbound_product.ts create mode 100644 src/api/psi/warehouse_order.ts create mode 100644 src/api/psi/warehouse_product.ts create mode 100644 src/views/psi/outbound_order/details.vue create mode 100644 src/views/psi/outbound_order/edit.vue create mode 100644 src/views/psi/outbound_order/index.vue create mode 100644 src/views/psi/outbound_product/details.vue create mode 100644 src/views/psi/outbound_product/edit.vue create mode 100644 src/views/psi/outbound_product/index.vue create mode 100644 src/views/psi/warehouse_order/details.vue create mode 100644 src/views/psi/warehouse_order/edit.vue create mode 100644 src/views/psi/warehouse_order/index.vue create mode 100644 src/views/psi/warehouse_product/details.vue create mode 100644 src/views/psi/warehouse_product/edit.vue create mode 100644 src/views/psi/warehouse_product/index.vue diff --git a/src/api/psi/outbound_order.ts b/src/api/psi/outbound_order.ts new file mode 100644 index 000000000..9ca2a5c52 --- /dev/null +++ b/src/api/psi/outbound_order.ts @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 出库订单列表 +export function apiPsiOutboundOrderLists(params: any) { + return request.get({ url: '/outboundorder/lists', params }, { urlPrefix: 'psi' }) +} + +// 添加出库订单 +export function apiPsiOutboundOrderAdd(params: any) { + return request.post({ url: '/outboundorder/add', params }, { urlPrefix: 'psi' }) +} + +// 编辑出库订单 +export function apiPsiOutboundOrderEdit(params: any) { + return request.post({ url: '/outboundorder/edit', params }, { urlPrefix: 'psi' }) +} + +// 删除出库订单 +export function apiPsiOutboundOrderDelete(params: any) { + return request.post({ url: '/outboundorder/delete', params }, { urlPrefix: 'psi' }) +} + +// 出库订单详情 +export function apiPsiOutboundOrderDetail(params: any) { + return request.get({ url: '/outboundorder/detail', params }, { urlPrefix: 'psi' }) +} \ No newline at end of file diff --git a/src/api/psi/outbound_product.ts b/src/api/psi/outbound_product.ts new file mode 100644 index 000000000..6eaa3eedf --- /dev/null +++ b/src/api/psi/outbound_product.ts @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 仓库商品出库信息列表 +export function apiPsiOutboundProductLists(params: any) { + return request.get({ url: '/outboundproduct/lists', params }, { urlPrefix: 'psi' }) +} + +// 添加仓库商品出库信息 +export function apiPsiOutboundProductAdd(params: any) { + return request.post({ url: '/outboundproduct/add', params }, { urlPrefix: 'psi' }) +} + +// 编辑仓库商品出库信息 +export function apiPsiOutboundProductEdit(params: any) { + return request.post({ url: '/outboundproduct/edit', params }, { urlPrefix: 'psi' }) +} + +// 删除仓库商品出库信息 +export function apiPsiOutboundProductDelete(params: any) { + return request.post({ url: '/outboundproduct/delete', params }, { urlPrefix: 'psi' }) +} + +// 仓库商品出库信息详情 +export function apiPsiOutboundProductDetail(params: any) { + return request.get({ url: '/outboundproduct/detail', params }, { urlPrefix: 'psi' }) +} \ No newline at end of file diff --git a/src/api/psi/warehouse_order.ts b/src/api/psi/warehouse_order.ts new file mode 100644 index 000000000..415d8a5e3 --- /dev/null +++ b/src/api/psi/warehouse_order.ts @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 入库订单列表 +export function apiPsiWarehouseOrderLists(params: any) { + return request.get({ url: '/warehouseorder/lists', params }, { urlPrefix: 'psi' }) +} + +// 添加入库订单 +export function apiPsiWarehouseOrderAdd(params: any) { + return request.post({ url: '/warehouseorder/add', params }, { urlPrefix: 'psi' }) +} + +// 编辑入库订单 +export function apiPsiWarehouseOrderEdit(params: any) { + return request.post({ url: '/warehouseorder/edit', params }, { urlPrefix: 'psi' }) +} + +// 删除入库订单 +export function apiPsiWarehouseOrderDelete(params: any) { + return request.post({ url: '/warehouseorder/delete', params }, { urlPrefix: 'psi' }) +} + +// 入库订单详情 +export function apiPsiWarehouseOrderDetail(params: any) { + return request.get({ url: '/warehouseorder/detail', params }, { urlPrefix: 'psi' }) +} \ No newline at end of file diff --git a/src/api/psi/warehouse_product.ts b/src/api/psi/warehouse_product.ts new file mode 100644 index 000000000..24e06c680 --- /dev/null +++ b/src/api/psi/warehouse_product.ts @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 仓库商品入库信息列表 +export function apiPsiWarehouseProductLists(params: any) { + return request.get({ url: '/warehouseproduct/lists', params }, { urlPrefix: 'psi' }) +} + +// 添加仓库商品入库信息 +export function apiPsiWarehouseProductAdd(params: any) { + return request.post({ url: '/warehouseproduct/add', params }, { urlPrefix: 'psi' }) +} + +// 编辑仓库商品入库信息 +export function apiPsiWarehouseProductEdit(params: any) { + return request.post({ url: '/warehouseproduct/edit', params }, { urlPrefix: 'psi' }) +} + +// 删除仓库商品入库信息 +export function apiPsiWarehouseProductDelete(params: any) { + return request.post({ url: '/warehouseproduct/delete', params }, { urlPrefix: 'psi' }) +} + +// 仓库商品入库信息详情 +export function apiPsiWarehouseProductDetail(params: any) { + return request.get({ url: '/warehouseproduct/detail', params }, { urlPrefix: 'psi' }) +} \ No newline at end of file diff --git a/src/api/psi/warehouse_storege.ts b/src/api/psi/warehouse_storege.ts index 8e0645a7d..caa9ad512 100644 --- a/src/api/psi/warehouse_storege.ts +++ b/src/api/psi/warehouse_storege.ts @@ -3,7 +3,7 @@ import request from '@/utils/request' // 仓库存储列表 export function apiPsiWarehouseStoregeLists(params: any) { return request.get( - { url: '/warehouse_storege/warehousestorege/lists', params }, + { url: '/warehouse_storage/warehousestorage/lists', params }, { urlPrefix: 'psi' } ) } @@ -11,7 +11,7 @@ export function apiPsiWarehouseStoregeLists(params: any) { // 添加仓库存储 export function apiPsiWarehouseStoregeAdd(params: any) { return request.post( - { url: '/warehouse_storege/warehousestorege/add', params }, + { url: '/warehouse_storage/warehousestorage/add', params }, { urlPrefix: 'psi' } ) } @@ -19,7 +19,7 @@ export function apiPsiWarehouseStoregeAdd(params: any) { // 编辑仓库存储 export function apiPsiWarehouseStoregeEdit(params: any) { return request.post( - { url: '/warehouse_storege/warehousestorege/edit', params }, + { url: '/warehouse_storage/warehousestorage/edit', params }, { urlPrefix: 'psi' } ) } @@ -27,7 +27,7 @@ export function apiPsiWarehouseStoregeEdit(params: any) { // 删除仓库存储 export function apiPsiWarehouseStoregeDelete(params: any) { return request.post( - { url: '/warehouse_storege/warehousestorege/delete', params }, + { url: '/warehouse_storage/warehousestorage/delete', params }, { urlPrefix: 'psi' } ) } @@ -35,7 +35,7 @@ export function apiPsiWarehouseStoregeDelete(params: any) { // 仓库存储详情 export function apiPsiWarehouseStoregeDetail(params: any) { return request.get( - { url: '/warehouse_storege/warehousestorege/detail', params }, + { url: '/warehouse_storage/warehousestorage/detail', params }, { urlPrefix: 'psi' } ) } @@ -46,7 +46,7 @@ export function apiPsiWarehouseStoregeDetail(params: any) { */ export function apiPsiWarehouseProductStoregeVerify(params: any) { return request.post({ - url: '/warehouse_storege/warehousestorege/verify', + url: '/warehouse_storage/warehousestorage/verify', params }, { urlPrefix: 'psi' }) diff --git a/src/views/psi/outbound_order/details.vue b/src/views/psi/outbound_order/details.vue new file mode 100644 index 000000000..192ba6593 --- /dev/null +++ b/src/views/psi/outbound_order/details.vue @@ -0,0 +1,143 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + title="详情" + :async="true" + width="550px" + :cancelButtonText="false" + :confirmButtonText="false" + > + <el-form ref="formRef" :model="formData" label-width="90px"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="true"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="true"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="true"/> + </el-form-item> + <el-form-item label="类型" prop="type"> + <el-input v-model="formData.type" clearable placeholder="请输入类型" :readonly="true"/> + </el-form-item> + <el-form-item label="订单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入订单ID" :readonly="true"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="true"/> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入单号" :readonly="true"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="true"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="true"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="true"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="true"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="true"/> + </el-form-item> + <el-form-item label="已结金额" prop="completed_amount"> + <el-input v-model="formData.completed_amount" clearable placeholder="请输入已结金额" :readonly="true"/> + </el-form-item> + <el-form-item label="未结金额" prop="outstanding_amount"> + <el-input v-model="formData.outstanding_amount" clearable placeholder="请输入未结金额" :readonly="true"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="true"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiOutboundOrderDETAILS"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiOutboundOrderAdd, apiPsiOutboundOrderEdit, apiPsiOutboundOrderDetail } from '@/api/psi/outbound_order' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + type: '', + oid: '', + order_type: '', + code: '', + admin_id: '', + batch: '', + mark: '', + nums: '', + purchase: '', + total_price: '', + completed_amount: '', + outstanding_amount: '', + status: '', +}) + + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiOutboundOrderDetail({ + id: row.id + }) + setFormData(data) +} + +//打开弹窗 +const open = () => { + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/outbound_order/edit.vue b/src/views/psi/outbound_order/edit.vue new file mode 100644 index 000000000..5eeeb2904 --- /dev/null +++ b/src/views/psi/outbound_order/edit.vue @@ -0,0 +1,165 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + :title="popupTitle" + :async="true" + width="550px" + @confirm="handleSubmit" + @close="handleClose" + > + <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="false"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="false"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="false"/> + </el-form-item> + <el-form-item label="类型" prop="type"> + <el-input v-model="formData.type" clearable placeholder="请输入类型" :readonly="false"/> + </el-form-item> + <el-form-item label="订单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入订单ID" :readonly="false"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="false"/> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入单号" :readonly="false"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="false"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="false"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="false"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="false"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="false"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="false"/> + </el-form-item> + <el-form-item label="已结金额" prop="completed_amount"> + <el-input v-model="formData.completed_amount" clearable placeholder="请输入已结金额" :readonly="false"/> + </el-form-item> + <el-form-item label="未结金额" prop="outstanding_amount"> + <el-input v-model="formData.outstanding_amount" clearable placeholder="请输入未结金额" :readonly="false"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="false"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiOutboundOrderEdit"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiOutboundOrderAdd, apiPsiOutboundOrderEdit, apiPsiOutboundOrderDetail } from '@/api/psi/outbound_order' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + +// 弹窗标题 +const popupTitle = computed(() => { + return mode.value == 'edit' ? '编辑出库订单' : '新增出库订单' +}) + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + type: '', + oid: '', + order_type: '', + code: '', + admin_id: '', + batch: '', + mark: '', + nums: '', + purchase: '', + total_price: '', + completed_amount: '', + outstanding_amount: '', + status: '', +}) + + +// 表单验证 +const formRules = reactive<any>({ + +}) + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiOutboundOrderDetail({ + id: row.id + }) + setFormData(data) +} + + +// 提交按钮 +const handleSubmit = async () => { + await formRef.value?.validate() + const data = { ...formData, } + mode.value == 'edit' + ? await apiPsiOutboundOrderEdit(data) + : await apiPsiOutboundOrderAdd(data) + popupRef.value?.close() + emit('success') +} + +//打开弹窗 +const open = (type = 'add') => { + mode.value = type + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/outbound_order/index.vue b/src/views/psi/outbound_order/index.vue new file mode 100644 index 000000000..3b90c7055 --- /dev/null +++ b/src/views/psi/outbound_order/index.vue @@ -0,0 +1,168 @@ +<template> + <div> + <el-card class="!border-none mb-4" shadow="never"> + <el-form + class="mb-[-16px]" + :model="queryParams" + inline + > + <el-form-item label="仓库" prop="warehouse_id"> + <el-input class="w-[280px]" v-model="queryParams.warehouse_id" clearable placeholder="请输入仓库" /> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input class="w-[280px]" v-model="queryParams.supplier_id" clearable placeholder="请输入供应商" /> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input class="w-[280px]" v-model="queryParams.store_id" clearable placeholder="请输入门店" /> + </el-form-item> + <el-form-item label="类型" prop="type"> + <el-input class="w-[280px]" v-model="queryParams.type" clearable placeholder="请输入类型" /> + </el-form-item> + <el-form-item label="订单ID" prop="oid"> + <el-input class="w-[280px]" v-model="queryParams.oid" clearable placeholder="请输入订单ID" /> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input class="w-[280px]" v-model="queryParams.order_type" clearable placeholder="请输入订单类型" /> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入单号" /> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input class="w-[280px]" v-model="queryParams.status" clearable placeholder="请输入状态" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-form> + </el-card> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <el-button v-perms="['psi_outbound_order/add']" type="primary" @click="handleAdd"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 新增 + </el-button> + <el-button + v-perms="['psi_outbound_order/delete']" + :disabled="!selectData.length" + @click="handleDelete(selectData)" + > + 删除 + </el-button> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" /> + <el-table-column label="ID" prop="id" show-overflow-tooltip /> + <el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> + <el-table-column label="供应商" prop="supplier_id" show-overflow-tooltip /> + <el-table-column label="门店" prop="store_id" show-overflow-tooltip /> + <el-table-column label="类型" prop="type" show-overflow-tooltip /> + <el-table-column label="订单ID" prop="oid" show-overflow-tooltip /> + <el-table-column label="订单类型" prop="order_type" show-overflow-tooltip /> + <el-table-column label="单号" prop="code" show-overflow-tooltip /> + <el-table-column label="备注" prop="mark" show-overflow-tooltip /> + <el-table-column label="数量" prop="nums" show-overflow-tooltip /> + <el-table-column label="供货价" prop="purchase" show-overflow-tooltip /> + <el-table-column label="总价格" prop="total_price" show-overflow-tooltip /> + <el-table-column label="已结金额" prop="completed_amount" show-overflow-tooltip /> + <el-table-column label="未结金额" prop="outstanding_amount" show-overflow-tooltip /> + <el-table-column label="状态" prop="status" show-overflow-tooltip /> + <el-table-column label="" prop="create_time" show-overflow-tooltip /> + <el-table-column label="操作" width="120" fixed="right"> + <template #default="{ row }"> + <el-button + v-perms="['psi_outbound_order/edit']" + type="primary" + link + @click="handleEdit(row)" + > + 编辑 + </el-button> + <el-button + v-perms="['psi_outbound_order/delete']" + type="danger" + link + @click="handleDelete(row.id)" + > + 删除 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> + </div> +</template> + +<script lang="ts" setup name="psiOutboundOrderLists"> +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import { apiPsiOutboundOrderLists, apiPsiOutboundOrderDelete } from '@/api/psi/outbound_order' +import { timeFormat } from '@/utils/util' +import feedback from '@/utils/feedback' +import EditPopup from './edit.vue' + +const editRef = shallowRef<InstanceType<typeof EditPopup>>() +// 是否显示编辑框 +const showEdit = ref(false) + + +// 查询条件 +const queryParams = reactive({ + warehouse_id: '', + supplier_id: '', + store_id: '', + type: '', + oid: '', + order_type: '', + code: '', + status: '', +}) + +// 选中数据 +const selectData = ref<any[]>([]) + +// 表格选择后回调事件 +const handleSelectionChange = (val: any[]) => { + selectData.value = val.map(({ id }) => id) +} + +// 获取字典数据 +const { dictData } = useDictData('') + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: apiPsiOutboundOrderLists, + params: queryParams +}) + +// 添加 +const handleAdd = async () => { + showEdit.value = true + await nextTick() + editRef.value?.open('add') +} + +// 编辑 +const handleEdit = async (data: any) => { + showEdit.value = true + await nextTick() + editRef.value?.open('edit') + editRef.value?.setFormData(data) +} + +// 删除 +const handleDelete = async (id: number | any[]) => { + await feedback.confirm('确定要删除?') + await apiPsiOutboundOrderDelete({ id }) + getLists() +} + +getLists() +</script> + diff --git a/src/views/psi/outbound_product/details.vue b/src/views/psi/outbound_product/details.vue new file mode 100644 index 000000000..8cdffc597 --- /dev/null +++ b/src/views/psi/outbound_product/details.vue @@ -0,0 +1,187 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + title="详情" + :async="true" + width="550px" + :cancelButtonText="false" + :confirmButtonText="false" + > + <el-form ref="formRef" :model="formData" label-width="90px"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="true"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="true"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="true"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="true"/> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="true"/> + </el-form-item> + <el-form-item label="单位" prop="unit"> + <el-input v-model="formData.unit" clearable placeholder="请输入单位" :readonly="true"/> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入入库单ID" :readonly="true"/> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入入库单号" :readonly="true"/> + </el-form-item> + <el-form-item label="生产日期" prop="manufacture"> + <el-input v-model="formData.manufacture" clearable placeholder="请输入生产日期" :readonly="true"/> + </el-form-item> + <el-form-item label="保质期" prop="expiration_date"> + <el-input v-model="formData.expiration_date" clearable placeholder="请输入保质期" :readonly="true"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="true"/> + </el-form-item> + <el-form-item label="确认人员" prop="enter_admin_id"> + <el-input v-model="formData.enter_admin_id" clearable placeholder="请输入确认人员" :readonly="true"/> + </el-form-item> + <el-form-item label="门店确认人员" prop="staff_id"> + <el-input v-model="formData.staff_id" clearable placeholder="请输入门店确认人员" :readonly="true"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="true"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/> + </el-form-item> + <el-form-item label="退货数量" prop="refund_nums"> + <el-input v-model="formData.refund_nums" clearable placeholder="请输入退货数量" :readonly="true"/> + </el-form-item> + <el-form-item label="更新前库存" prop="before_nums"> + <el-input v-model="formData.before_nums" clearable placeholder="请输入更新前库存" :readonly="true"/> + </el-form-item> + <el-form-item label="更新后库存" prop="after_nums"> + <el-input v-model="formData.after_nums" clearable placeholder="请输入更新后库存" :readonly="true"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="true"/> + </el-form-item> + <el-form-item label="零售价格" prop="price"> + <el-input v-model="formData.price" clearable placeholder="请输入零售价格" :readonly="true"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="true"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="true"/> + </el-form-item> + <el-form-item label="商户价" prop="cost"> + <el-input v-model="formData.cost" clearable placeholder="请输入商户价" :readonly="true"/> + </el-form-item> + <el-form-item label="会员价" prop="vip_price"> + <el-input v-model="formData.vip_price" clearable placeholder="请输入会员价" :readonly="true"/> + </el-form-item> + <el-form-item label="是否结清" prop="is_pay"> + <el-input v-model="formData.is_pay" clearable placeholder="请输入是否结清" :readonly="true"/> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input v-model="formData.pay_type" clearable placeholder="请输入支付方式" :readonly="true"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="true"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiOutboundProductDETAILS"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiOutboundProductAdd, apiPsiOutboundProductEdit, apiPsiOutboundProductDetail } from '@/api/psi/outbound_product' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + unit: '', + oid: '', + code: '', + manufacture: '', + expiration_date: '', + admin_id: '', + enter_admin_id: '', + staff_id: '', + batch: '', + nums: '', + refund_nums: '', + before_nums: '', + after_nums: '', + mark: '', + price: '', + total_price: '', + purchase: '', + cost: '', + vip_price: '', + is_pay: '', + pay_type: '', + status: '', +}) + + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiOutboundProductDetail({ + id: row.id + }) + setFormData(data) +} + +//打开弹窗 +const open = () => { + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/outbound_product/edit.vue b/src/views/psi/outbound_product/edit.vue new file mode 100644 index 000000000..a392df381 --- /dev/null +++ b/src/views/psi/outbound_product/edit.vue @@ -0,0 +1,238 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + :title="popupTitle" + :async="true" + width="550px" + @confirm="handleSubmit" + @close="handleClose" + > + <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="false"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="false"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="false"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="false"/> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="false"/> + </el-form-item> + <el-form-item label="单位" prop="unit"> + <el-input v-model="formData.unit" clearable placeholder="请输入单位" :readonly="false"/> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入入库单ID" :readonly="false"/> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入入库单号" :readonly="false"/> + </el-form-item> + <el-form-item label="生产日期" prop="manufacture"> + <el-input v-model="formData.manufacture" clearable placeholder="请输入生产日期" :readonly="false"/> + </el-form-item> + <el-form-item label="保质期" prop="expiration_date"> + <el-input v-model="formData.expiration_date" clearable placeholder="请输入保质期" :readonly="false"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="false"/> + </el-form-item> + <el-form-item label="确认人员" prop="enter_admin_id"> + <el-input v-model="formData.enter_admin_id" clearable placeholder="请输入确认人员" :readonly="false"/> + </el-form-item> + <el-form-item label="门店确认人员" prop="staff_id"> + <el-input v-model="formData.staff_id" clearable placeholder="请输入门店确认人员" :readonly="false"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="false"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="false"/> + </el-form-item> + <el-form-item label="退货数量" prop="refund_nums"> + <el-input v-model="formData.refund_nums" clearable placeholder="请输入退货数量" :readonly="false"/> + </el-form-item> + <el-form-item label="更新前库存" prop="before_nums"> + <el-input v-model="formData.before_nums" clearable placeholder="请输入更新前库存" :readonly="false"/> + </el-form-item> + <el-form-item label="更新后库存" prop="after_nums"> + <el-input v-model="formData.after_nums" clearable placeholder="请输入更新后库存" :readonly="false"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="false"/> + </el-form-item> + <el-form-item label="零售价格" prop="price"> + <el-input v-model="formData.price" clearable placeholder="请输入零售价格" :readonly="false"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="false"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="false"/> + </el-form-item> + <el-form-item label="商户价" prop="cost"> + <el-input v-model="formData.cost" clearable placeholder="请输入商户价" :readonly="false"/> + </el-form-item> + <el-form-item label="会员价" prop="vip_price"> + <el-input v-model="formData.vip_price" clearable placeholder="请输入会员价" :readonly="false"/> + </el-form-item> + <el-form-item label="是否结清" prop="is_pay"> + <el-input v-model="formData.is_pay" clearable placeholder="请输入是否结清" :readonly="false"/> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input v-model="formData.pay_type" clearable placeholder="请输入支付方式" :readonly="false"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="false"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiOutboundProductEdit"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiOutboundProductAdd, apiPsiOutboundProductEdit, apiPsiOutboundProductDetail } from '@/api/psi/outbound_product' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + +// 弹窗标题 +const popupTitle = computed(() => { + return mode.value == 'edit' ? '编辑仓库商品出库信息' : '新增仓库商品出库信息' +}) + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + unit: '', + oid: '', + code: '', + manufacture: '', + expiration_date: '', + admin_id: '', + enter_admin_id: '', + staff_id: '', + batch: '', + nums: '', + refund_nums: '', + before_nums: '', + after_nums: '', + mark: '', + price: '', + total_price: '', + purchase: '', + cost: '', + vip_price: '', + is_pay: '', + pay_type: '', + status: '', +}) + + +// 表单验证 +const formRules = reactive<any>({ + product_id: [{ + required: true, + message: '请输入商品', + trigger: ['blur'] + }], + batch: [{ + required: true, + message: '请输入批次', + trigger: ['blur'] + }], + nums: [{ + required: true, + message: '请输入数量', + trigger: ['blur'] + }], + price: [{ + required: true, + message: '请输入零售价格', + trigger: ['blur'] + }], + total_price: [{ + required: true, + message: '请输入总价格', + trigger: ['blur'] + }], + status: [{ + required: true, + message: '请输入状态', + trigger: ['blur'] + }], +}) + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiOutboundProductDetail({ + id: row.id + }) + setFormData(data) +} + + +// 提交按钮 +const handleSubmit = async () => { + await formRef.value?.validate() + const data = { ...formData, } + mode.value == 'edit' + ? await apiPsiOutboundProductEdit(data) + : await apiPsiOutboundProductAdd(data) + popupRef.value?.close() + emit('success') +} + +//打开弹窗 +const open = (type = 'add') => { + mode.value = type + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/outbound_product/index.vue b/src/views/psi/outbound_product/index.vue new file mode 100644 index 000000000..36a93ad75 --- /dev/null +++ b/src/views/psi/outbound_product/index.vue @@ -0,0 +1,174 @@ +<template> + <div> + <el-card class="!border-none mb-4" shadow="never"> + <el-form + class="mb-[-16px]" + :model="queryParams" + inline + > + <el-form-item label="仓库" prop="warehouse_id"> + <el-input class="w-[280px]" v-model="queryParams.warehouse_id" clearable placeholder="请输入仓库" /> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input class="w-[280px]" v-model="queryParams.supplier_id" clearable placeholder="请输入供应商" /> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input class="w-[280px]" v-model="queryParams.store_id" clearable placeholder="请输入门店" /> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input class="w-[280px]" v-model="queryParams.order_type" clearable placeholder="请输入订单类型" /> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input class="w-[280px]" v-model="queryParams.product_id" clearable placeholder="请输入商品" /> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input class="w-[280px]" v-model="queryParams.oid" clearable placeholder="请输入入库单ID" /> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入入库单号" /> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请输入支付方式" /> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input class="w-[280px]" v-model="queryParams.status" clearable placeholder="请输入状态" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-form> + </el-card> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <el-button v-perms="['psi_outbound_product/add']" type="primary" @click="handleAdd"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 新增 + </el-button> + <el-button + v-perms="['psi_outbound_product/delete']" + :disabled="!selectData.length" + @click="handleDelete(selectData)" + > + 删除 + </el-button> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" /> + <el-table-column label="ID" prop="id" show-overflow-tooltip /> + <el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> + <el-table-column label="供应商" prop="supplier_id" show-overflow-tooltip /> + <el-table-column label="门店" prop="store_id" show-overflow-tooltip /> + <el-table-column label="订单类型" prop="order_type" show-overflow-tooltip /> + <el-table-column label="商品" prop="product_id" show-overflow-tooltip /> + <el-table-column label="入库单ID" prop="oid" show-overflow-tooltip /> + <el-table-column label="入库单号" prop="code" show-overflow-tooltip /> + <el-table-column label="数量" prop="nums" show-overflow-tooltip /> + <el-table-column label="退货数量" prop="refund_nums" show-overflow-tooltip /> + <el-table-column label="更新前库存" prop="before_nums" show-overflow-tooltip /> + <el-table-column label="更新后库存" prop="after_nums" show-overflow-tooltip /> + <el-table-column label="备注" prop="mark" show-overflow-tooltip /> + <el-table-column label="总价格" prop="total_price" show-overflow-tooltip /> + <el-table-column label="供货价" prop="purchase" show-overflow-tooltip /> + <el-table-column label="是否结清" prop="is_pay" show-overflow-tooltip /> + <el-table-column label="支付方式" prop="pay_type" show-overflow-tooltip /> + <el-table-column label="状态" prop="status" show-overflow-tooltip /> + <el-table-column label="操作" width="120" fixed="right"> + <template #default="{ row }"> + <el-button + v-perms="['psi_outbound_product/edit']" + type="primary" + link + @click="handleEdit(row)" + > + 编辑 + </el-button> + <el-button + v-perms="['psi_outbound_product/delete']" + type="danger" + link + @click="handleDelete(row.id)" + > + 删除 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> + </div> +</template> + +<script lang="ts" setup name="psiOutboundProductLists"> +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import { apiPsiOutboundProductLists, apiPsiOutboundProductDelete } from '@/api/psi/outbound_product' +import { timeFormat } from '@/utils/util' +import feedback from '@/utils/feedback' +import EditPopup from './edit.vue' + +const editRef = shallowRef<InstanceType<typeof EditPopup>>() +// 是否显示编辑框 +const showEdit = ref(false) + + +// 查询条件 +const queryParams = reactive({ + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + oid: '', + code: '', + pay_type: '', + status: '', +}) + +// 选中数据 +const selectData = ref<any[]>([]) + +// 表格选择后回调事件 +const handleSelectionChange = (val: any[]) => { + selectData.value = val.map(({ id }) => id) +} + +// 获取字典数据 +const { dictData } = useDictData('') + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: apiPsiOutboundProductLists, + params: queryParams +}) + +// 添加 +const handleAdd = async () => { + showEdit.value = true + await nextTick() + editRef.value?.open('add') +} + +// 编辑 +const handleEdit = async (data: any) => { + showEdit.value = true + await nextTick() + editRef.value?.open('edit') + editRef.value?.setFormData(data) +} + +// 删除 +const handleDelete = async (id: number | any[]) => { + await feedback.confirm('确定要删除?') + await apiPsiOutboundProductDelete({ id }) + getLists() +} + +getLists() +</script> + diff --git a/src/views/psi/warehouse_order/details.vue b/src/views/psi/warehouse_order/details.vue new file mode 100644 index 000000000..49d7ce086 --- /dev/null +++ b/src/views/psi/warehouse_order/details.vue @@ -0,0 +1,153 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + title="详情" + :async="true" + width="550px" + :cancelButtonText="false" + :confirmButtonText="false" + > + <el-form ref="formRef" :model="formData" label-width="90px"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="true"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="true"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="true"/> + </el-form-item> + <el-form-item label="订单id" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入订单id" :readonly="true"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-select class="flex-1" v-model="formData.order_type" clearable placeholder="请选择订单类型" :disabled="true"> + <el-option + v-for="(item, index) in dictData.product_type" + :key="index" + :label="item.name" + :value="parseInt(item.value)" + /> + </el-select> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入单号" :readonly="true"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="true"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="true"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="true"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="true"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="true"/> + </el-form-item> + <el-form-item label="已结金额" prop="completed_amount"> + <el-input v-model="formData.completed_amount" clearable placeholder="请输入已结金额" :readonly="true"/> + </el-form-item> + <el-form-item label="未结金额" prop="outstanding_amount"> + <el-input v-model="formData.outstanding_amount" clearable placeholder="请输入未结金额" :readonly="true"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择状态" :disabled="true"> + <el-option + v-for="(item, index) in dictData.warehouse_produc_pm" + :key="index" + :label="item.name" + :value="parseInt(item.value)" + /> + </el-select> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseOrderDETAILS"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiWarehouseOrderAdd, apiPsiWarehouseOrderEdit, apiPsiWarehouseOrderDetail } from '@/api/psi/warehouse_order' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + oid: '', + order_type: '', + code: '', + admin_id: '', + batch: '', + mark: '', + nums: '', + purchase: '', + total_price: '', + completed_amount: '', + outstanding_amount: '', + status: '', +}) + + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiWarehouseOrderDetail({ + id: row.id + }) + setFormData(data) +} + +//打开弹窗 +const open = () => { + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/warehouse_order/edit.vue b/src/views/psi/warehouse_order/edit.vue new file mode 100644 index 000000000..e02722256 --- /dev/null +++ b/src/views/psi/warehouse_order/edit.vue @@ -0,0 +1,189 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + :title="popupTitle" + :async="true" + width="550px" + @confirm="handleSubmit" + @close="handleClose" + > + <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="false"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="false"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="false"/> + </el-form-item> + <el-form-item label="订单id" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入订单id" :readonly="false"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-select class="flex-1" v-model="formData.order_type" clearable placeholder="请选择订单类型" :disabled="false"> + <el-option + v-for="(item, index) in dictData.product_type" + :key="index" + :label="item.name" + :value="parseInt(item.value)" + /> + </el-select> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入单号" :readonly="false"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="false"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="false"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="false"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="false"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="false"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="false"/> + </el-form-item> + <el-form-item label="已结金额" prop="completed_amount"> + <el-input v-model="formData.completed_amount" clearable placeholder="请输入已结金额" :readonly="false"/> + </el-form-item> + <el-form-item label="未结金额" prop="outstanding_amount"> + <el-input v-model="formData.outstanding_amount" clearable placeholder="请输入未结金额" :readonly="false"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择状态" :disabled="false"> + <el-option + v-for="(item, index) in dictData.warehouse_produc_pm" + :key="index" + :label="item.name" + :value="parseInt(item.value)" + /> + </el-select> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseOrderEdit"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiWarehouseOrderAdd, apiPsiWarehouseOrderEdit, apiPsiWarehouseOrderDetail } from '@/api/psi/warehouse_order' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + +// 弹窗标题 +const popupTitle = computed(() => { + return mode.value == 'edit' ? '编辑入库订单' : '新增入库订单' +}) + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + oid: '', + order_type: '', + code: '', + admin_id: '', + batch: '', + mark: '', + nums: '', + purchase: '', + total_price: '', + completed_amount: '', + outstanding_amount: '', + status: '', +}) + + +// 表单验证 +const formRules = reactive<any>({ + batch: [{ + required: true, + message: '请输入批次', + trigger: ['blur'] + }], + total_price: [{ + required: true, + message: '请输入总价格', + trigger: ['blur'] + }], + status: [{ + required: true, + message: '请选择状态', + trigger: ['blur'] + }], +}) + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiWarehouseOrderDetail({ + id: row.id + }) + setFormData(data) +} + + +// 提交按钮 +const handleSubmit = async () => { + await formRef.value?.validate() + const data = { ...formData, } + mode.value == 'edit' + ? await apiPsiWarehouseOrderEdit(data) + : await apiPsiWarehouseOrderAdd(data) + popupRef.value?.close() + emit('success') +} + +//打开弹窗 +const open = (type = 'add') => { + mode.value = type + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/warehouse_order/index.vue b/src/views/psi/warehouse_order/index.vue new file mode 100644 index 000000000..2372bd005 --- /dev/null +++ b/src/views/psi/warehouse_order/index.vue @@ -0,0 +1,188 @@ +<template> + <div> + <el-card class="!border-none mb-4" shadow="never"> + <el-form + class="mb-[-16px]" + :model="queryParams" + inline + > + <el-form-item label="仓库" prop="warehouse_id"> + <el-input class="w-[280px]" v-model="queryParams.warehouse_id" clearable placeholder="请输入仓库" /> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input class="w-[280px]" v-model="queryParams.store_id" clearable placeholder="请输入门店" /> + </el-form-item> + <el-form-item label="订单id" prop="oid"> + <el-input class="w-[280px]" v-model="queryParams.oid" clearable placeholder="请输入订单id" /> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-select + v-model="queryParams.order_type" clearable placeholder="请选择订单类型"> + <el-option label="全部" value=""></el-option> + <el-option + v-for="(item, index) in dictData.product_type" + :key="index" + :label="item.name" + :value="item.value" + /> + </el-select> + </el-form-item> + <el-form-item label="单号" prop="code"> + <el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入单号" /> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-select + v-model="queryParams.status" clearable placeholder="请选择状态"> + <el-option label="全部" value=""></el-option> + <el-option + v-for="(item, index) in dictData.warehouse_produc_pm" + :key="index" + :label="item.name" + :value="item.value" + /> + </el-select> + </el-form-item> + <el-form-item label="" prop="create_time"> + <el-input class="w-[280px]" v-model="queryParams.create_time" clearable placeholder="请输入" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-form> + </el-card> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <el-button v-perms="['psi_warehouse_order/add']" type="primary" @click="handleAdd"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 新增 + </el-button> + <el-button + v-perms="['psi_warehouse_order/delete']" + :disabled="!selectData.length" + @click="handleDelete(selectData)" + > + 删除 + </el-button> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" /> + <el-table-column label="ID" prop="id" show-overflow-tooltip /> + <el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> + <el-table-column label="供应商" prop="supplier_id" show-overflow-tooltip /> + <el-table-column label="门店" prop="store_id" show-overflow-tooltip /> + <el-table-column label="订单id" prop="oid" show-overflow-tooltip /> + <el-table-column label="订单类型" prop="order_type"> + <template #default="{ row }"> + <dict-value :options="dictData.product_type" :value="row.order_type" /> + </template> + </el-table-column> + <el-table-column label="单号" prop="code" show-overflow-tooltip /> + <el-table-column label="备注" prop="mark" show-overflow-tooltip /> + <el-table-column label="数量" prop="nums" show-overflow-tooltip /> + <el-table-column label="供货价" prop="purchase" show-overflow-tooltip /> + <el-table-column label="总价格" prop="total_price" show-overflow-tooltip /> + <el-table-column label="已结金额" prop="completed_amount" show-overflow-tooltip /> + <el-table-column label="未结金额" prop="outstanding_amount" show-overflow-tooltip /> + <el-table-column label="状态" prop="status"> + <template #default="{ row }"> + <dict-value :options="dictData.warehouse_produc_pm" :value="row.status" /> + </template> + </el-table-column> + <el-table-column label="操作" width="120" fixed="right"> + <template #default="{ row }"> + <el-button + v-perms="['psi_warehouse_order/edit']" + type="primary" + link + @click="handleEdit(row)" + > + 编辑 + </el-button> + <el-button + v-perms="['psi_warehouse_order/delete']" + type="danger" + link + @click="handleDelete(row.id)" + > + 删除 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseOrderLists"> +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import { apiPsiWarehouseOrderLists, apiPsiWarehouseOrderDelete } from '@/api/psi/warehouse_order' +import { timeFormat } from '@/utils/util' +import feedback from '@/utils/feedback' +import EditPopup from './edit.vue' + +const editRef = shallowRef<InstanceType<typeof EditPopup>>() +// 是否显示编辑框 +const showEdit = ref(false) + + +// 查询条件 +const queryParams = reactive({ + warehouse_id: '', + store_id: '', + oid: '', + order_type: '', + code: '', + status: '', + create_time: '', +}) + +// 选中数据 +const selectData = ref<any[]>([]) + +// 表格选择后回调事件 +const handleSelectionChange = (val: any[]) => { + selectData.value = val.map(({ id }) => id) +} + +// 获取字典数据 +const { dictData } = useDictData('product_type,warehouse_produc_pm') + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: apiPsiWarehouseOrderLists, + params: queryParams +}) + +// 添加 +const handleAdd = async () => { + showEdit.value = true + await nextTick() + editRef.value?.open('add') +} + +// 编辑 +const handleEdit = async (data: any) => { + showEdit.value = true + await nextTick() + editRef.value?.open('edit') + editRef.value?.setFormData(data) +} + +// 删除 +const handleDelete = async (id: number | any[]) => { + await feedback.confirm('确定要删除?') + await apiPsiWarehouseOrderDelete({ id }) + getLists() +} + +getLists() +</script> + diff --git a/src/views/psi/warehouse_product/details.vue b/src/views/psi/warehouse_product/details.vue new file mode 100644 index 000000000..8de8b96ce --- /dev/null +++ b/src/views/psi/warehouse_product/details.vue @@ -0,0 +1,187 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + title="详情" + :async="true" + width="550px" + :cancelButtonText="false" + :confirmButtonText="false" + > + <el-form ref="formRef" :model="formData" label-width="90px"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="true"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="true"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="true"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="true"/> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="true"/> + </el-form-item> + <el-form-item label="单位" prop="unit"> + <el-input v-model="formData.unit" clearable placeholder="请输入单位" :readonly="true"/> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入入库单ID" :readonly="true"/> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入入库单号" :readonly="true"/> + </el-form-item> + <el-form-item label="生产日期" prop="manufacture"> + <el-input v-model="formData.manufacture" clearable placeholder="请输入生产日期" :readonly="true"/> + </el-form-item> + <el-form-item label="保质期" prop="expiration_date"> + <el-input v-model="formData.expiration_date" clearable placeholder="请输入保质期" :readonly="true"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="true"/> + </el-form-item> + <el-form-item label="确认人员" prop="enter_admin_id"> + <el-input v-model="formData.enter_admin_id" clearable placeholder="请输入确认人员" :readonly="true"/> + </el-form-item> + <el-form-item label="门店确认人员" prop="staff_id"> + <el-input v-model="formData.staff_id" clearable placeholder="请输入门店确认人员" :readonly="true"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="true"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/> + </el-form-item> + <el-form-item label="退货数量" prop="refund_nums"> + <el-input v-model="formData.refund_nums" clearable placeholder="请输入退货数量" :readonly="true"/> + </el-form-item> + <el-form-item label="更新前库存" prop="before_nums"> + <el-input v-model="formData.before_nums" clearable placeholder="请输入更新前库存" :readonly="true"/> + </el-form-item> + <el-form-item label="更新后库存" prop="after_nums"> + <el-input v-model="formData.after_nums" clearable placeholder="请输入更新后库存" :readonly="true"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="true"/> + </el-form-item> + <el-form-item label="零售价格" prop="price"> + <el-input v-model="formData.price" clearable placeholder="请输入零售价格" :readonly="true"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="true"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="true"/> + </el-form-item> + <el-form-item label="商户价" prop="cost"> + <el-input v-model="formData.cost" clearable placeholder="请输入商户价" :readonly="true"/> + </el-form-item> + <el-form-item label="会员价" prop="vip_price"> + <el-input v-model="formData.vip_price" clearable placeholder="请输入会员价" :readonly="true"/> + </el-form-item> + <el-form-item label="是否结清" prop="is_pay"> + <el-input v-model="formData.is_pay" clearable placeholder="请输入是否结清" :readonly="true"/> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input v-model="formData.pay_type" clearable placeholder="请输入支付方式" :readonly="true"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="true"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseProductDETAILS"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiWarehouseProductAdd, apiPsiWarehouseProductEdit, apiPsiWarehouseProductDetail } from '@/api/psi/warehouse_product' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + unit: '', + oid: '', + code: '', + manufacture: '', + expiration_date: '', + admin_id: '', + enter_admin_id: '', + staff_id: '', + batch: '', + nums: '', + refund_nums: '', + before_nums: '', + after_nums: '', + mark: '', + price: '', + total_price: '', + purchase: '', + cost: '', + vip_price: '', + is_pay: '', + pay_type: '', + status: '', +}) + + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiWarehouseProductDetail({ + id: row.id + }) + setFormData(data) +} + +//打开弹窗 +const open = () => { + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/warehouse_product/edit.vue b/src/views/psi/warehouse_product/edit.vue new file mode 100644 index 000000000..2c4028bf4 --- /dev/null +++ b/src/views/psi/warehouse_product/edit.vue @@ -0,0 +1,238 @@ +<template> + <div class="edit-popup"> + <popup + ref="popupRef" + :title="popupTitle" + :async="true" + width="550px" + @confirm="handleSubmit" + @close="handleClose" + > + <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> + <el-form-item label="仓库" prop="warehouse_id"> + <el-input v-model="formData.warehouse_id" clearable placeholder="请输入仓库" :readonly="false"/> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input v-model="formData.supplier_id" clearable placeholder="请输入供应商" :readonly="false"/> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input v-model="formData.store_id" clearable placeholder="请输入门店" :readonly="false"/> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input v-model="formData.order_type" clearable placeholder="请输入订单类型" :readonly="false"/> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="false"/> + </el-form-item> + <el-form-item label="单位" prop="unit"> + <el-input v-model="formData.unit" clearable placeholder="请输入单位" :readonly="false"/> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input v-model="formData.oid" clearable placeholder="请输入入库单ID" :readonly="false"/> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input v-model="formData.code" clearable placeholder="请输入入库单号" :readonly="false"/> + </el-form-item> + <el-form-item label="生产日期" prop="manufacture"> + <el-input v-model="formData.manufacture" clearable placeholder="请输入生产日期" :readonly="false"/> + </el-form-item> + <el-form-item label="保质期" prop="expiration_date"> + <el-input v-model="formData.expiration_date" clearable placeholder="请输入保质期" :readonly="false"/> + </el-form-item> + <el-form-item label="填写人员" prop="admin_id"> + <el-input v-model="formData.admin_id" clearable placeholder="请输入填写人员" :readonly="false"/> + </el-form-item> + <el-form-item label="确认人员" prop="enter_admin_id"> + <el-input v-model="formData.enter_admin_id" clearable placeholder="请输入确认人员" :readonly="false"/> + </el-form-item> + <el-form-item label="门店确认人员" prop="staff_id"> + <el-input v-model="formData.staff_id" clearable placeholder="请输入门店确认人员" :readonly="false"/> + </el-form-item> + <el-form-item label="批次" prop="batch"> + <el-input v-model="formData.batch" clearable placeholder="请输入批次" :readonly="false"/> + </el-form-item> + <el-form-item label="数量" prop="nums"> + <el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="false"/> + </el-form-item> + <el-form-item label="退货数量" prop="refund_nums"> + <el-input v-model="formData.refund_nums" clearable placeholder="请输入退货数量" :readonly="false"/> + </el-form-item> + <el-form-item label="更新前库存" prop="before_nums"> + <el-input v-model="formData.before_nums" clearable placeholder="请输入更新前库存" :readonly="false"/> + </el-form-item> + <el-form-item label="更新后库存" prop="after_nums"> + <el-input v-model="formData.after_nums" clearable placeholder="请输入更新后库存" :readonly="false"/> + </el-form-item> + <el-form-item label="备注" prop="mark"> + <el-input v-model="formData.mark" clearable placeholder="请输入备注" :readonly="false"/> + </el-form-item> + <el-form-item label="零售价格" prop="price"> + <el-input v-model="formData.price" clearable placeholder="请输入零售价格" :readonly="false"/> + </el-form-item> + <el-form-item label="总价格" prop="total_price"> + <el-input v-model="formData.total_price" clearable placeholder="请输入总价格" :readonly="false"/> + </el-form-item> + <el-form-item label="供货价" prop="purchase"> + <el-input v-model="formData.purchase" clearable placeholder="请输入供货价" :readonly="false"/> + </el-form-item> + <el-form-item label="商户价" prop="cost"> + <el-input v-model="formData.cost" clearable placeholder="请输入商户价" :readonly="false"/> + </el-form-item> + <el-form-item label="会员价" prop="vip_price"> + <el-input v-model="formData.vip_price" clearable placeholder="请输入会员价" :readonly="false"/> + </el-form-item> + <el-form-item label="是否结清" prop="is_pay"> + <el-input v-model="formData.is_pay" clearable placeholder="请输入是否结清" :readonly="false"/> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input v-model="formData.pay_type" clearable placeholder="请输入支付方式" :readonly="false"/> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="false"/> + </el-form-item> + </el-form> + </popup> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseProductEdit"> +import type { FormInstance } from 'element-plus' +import Popup from '@/components/popup/index.vue' +import { apiPsiWarehouseProductAdd, apiPsiWarehouseProductEdit, apiPsiWarehouseProductDetail } from '@/api/psi/warehouse_product' +import { timeFormat } from '@/utils/util' +import type { PropType } from 'vue' +defineProps({ + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref('add') + + +// 弹窗标题 +const popupTitle = computed(() => { + return mode.value == 'edit' ? '编辑仓库商品入库信息' : '新增仓库商品入库信息' +}) + +// 表单数据 +const formData = reactive({ + id: '', + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + unit: '', + oid: '', + code: '', + manufacture: '', + expiration_date: '', + admin_id: '', + enter_admin_id: '', + staff_id: '', + batch: '', + nums: '', + refund_nums: '', + before_nums: '', + after_nums: '', + mark: '', + price: '', + total_price: '', + purchase: '', + cost: '', + vip_price: '', + is_pay: '', + pay_type: '', + status: '', +}) + + +// 表单验证 +const formRules = reactive<any>({ + product_id: [{ + required: true, + message: '请输入商品', + trigger: ['blur'] + }], + batch: [{ + required: true, + message: '请输入批次', + trigger: ['blur'] + }], + nums: [{ + required: true, + message: '请输入数量', + trigger: ['blur'] + }], + price: [{ + required: true, + message: '请输入零售价格', + trigger: ['blur'] + }], + total_price: [{ + required: true, + message: '请输入总价格', + trigger: ['blur'] + }], + status: [{ + required: true, + message: '请输入状态', + trigger: ['blur'] + }], +}) + + +// 获取详情 +const setFormData = async (data: Record<any, any>) => { + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } + } + + +} + +const getDetail = async (row: Record<string, any>) => { + const data = await apiPsiWarehouseProductDetail({ + id: row.id + }) + setFormData(data) +} + + +// 提交按钮 +const handleSubmit = async () => { + await formRef.value?.validate() + const data = { ...formData, } + mode.value == 'edit' + ? await apiPsiWarehouseProductEdit(data) + : await apiPsiWarehouseProductAdd(data) + popupRef.value?.close() + emit('success') +} + +//打开弹窗 +const open = (type = 'add') => { + mode.value = type + popupRef.value?.open() +} + +// 关闭回调 +const handleClose = () => { + emit('close') +} + + + +defineExpose({ + open, + setFormData, + getDetail +}) +</script> diff --git a/src/views/psi/warehouse_product/index.vue b/src/views/psi/warehouse_product/index.vue new file mode 100644 index 000000000..782dc963b --- /dev/null +++ b/src/views/psi/warehouse_product/index.vue @@ -0,0 +1,174 @@ +<template> + <div> + <el-card class="!border-none mb-4" shadow="never"> + <el-form + class="mb-[-16px]" + :model="queryParams" + inline + > + <el-form-item label="仓库" prop="warehouse_id"> + <el-input class="w-[280px]" v-model="queryParams.warehouse_id" clearable placeholder="请输入仓库" /> + </el-form-item> + <el-form-item label="供应商" prop="supplier_id"> + <el-input class="w-[280px]" v-model="queryParams.supplier_id" clearable placeholder="请输入供应商" /> + </el-form-item> + <el-form-item label="门店" prop="store_id"> + <el-input class="w-[280px]" v-model="queryParams.store_id" clearable placeholder="请输入门店" /> + </el-form-item> + <el-form-item label="订单类型" prop="order_type"> + <el-input class="w-[280px]" v-model="queryParams.order_type" clearable placeholder="请输入订单类型" /> + </el-form-item> + <el-form-item label="商品" prop="product_id"> + <el-input class="w-[280px]" v-model="queryParams.product_id" clearable placeholder="请输入商品" /> + </el-form-item> + <el-form-item label="入库单ID" prop="oid"> + <el-input class="w-[280px]" v-model="queryParams.oid" clearable placeholder="请输入入库单ID" /> + </el-form-item> + <el-form-item label="入库单号" prop="code"> + <el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入入库单号" /> + </el-form-item> + <el-form-item label="支付方式" prop="pay_type"> + <el-input class="w-[280px]" v-model="queryParams.pay_type" clearable placeholder="请输入支付方式" /> + </el-form-item> + <el-form-item label="状态" prop="status"> + <el-input class="w-[280px]" v-model="queryParams.status" clearable placeholder="请输入状态" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-form> + </el-card> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <el-button v-perms="['psi_warehouse_product/add']" type="primary" @click="handleAdd"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 新增 + </el-button> + <el-button + v-perms="['psi_warehouse_product/delete']" + :disabled="!selectData.length" + @click="handleDelete(selectData)" + > + 删除 + </el-button> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" /> + <el-table-column label="ID" prop="id" show-overflow-tooltip /> + <el-table-column label="仓库" prop="warehouse_id" show-overflow-tooltip /> + <el-table-column label="供应商" prop="supplier_id" show-overflow-tooltip /> + <el-table-column label="门店" prop="store_id" show-overflow-tooltip /> + <el-table-column label="订单类型" prop="order_type" show-overflow-tooltip /> + <el-table-column label="商品" prop="product_id" show-overflow-tooltip /> + <el-table-column label="单位" prop="unit" show-overflow-tooltip /> + <el-table-column label="入库单ID" prop="oid" show-overflow-tooltip /> + <el-table-column label="入库单号" prop="code" show-overflow-tooltip /> + <el-table-column label="数量" prop="nums" show-overflow-tooltip /> + <el-table-column label="退货数量" prop="refund_nums" show-overflow-tooltip /> + <el-table-column label="更新前库存" prop="before_nums" show-overflow-tooltip /> + <el-table-column label="更新后库存" prop="after_nums" show-overflow-tooltip /> + <el-table-column label="备注" prop="mark" show-overflow-tooltip /> + <el-table-column label="总价格" prop="total_price" show-overflow-tooltip /> + <el-table-column label="供货价" prop="purchase" show-overflow-tooltip /> + <el-table-column label="支付方式" prop="pay_type" show-overflow-tooltip /> + <el-table-column label="状态" prop="status" show-overflow-tooltip /> + <el-table-column label="操作" width="120" fixed="right"> + <template #default="{ row }"> + <el-button + v-perms="['psi_warehouse_product/edit']" + type="primary" + link + @click="handleEdit(row)" + > + 编辑 + </el-button> + <el-button + v-perms="['psi_warehouse_product/delete']" + type="danger" + link + @click="handleDelete(row.id)" + > + 删除 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> + </div> +</template> + +<script lang="ts" setup name="psiWarehouseProductLists"> +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import { apiPsiWarehouseProductLists, apiPsiWarehouseProductDelete } from '@/api/psi/warehouse_product' +import { timeFormat } from '@/utils/util' +import feedback from '@/utils/feedback' +import EditPopup from './edit.vue' + +const editRef = shallowRef<InstanceType<typeof EditPopup>>() +// 是否显示编辑框 +const showEdit = ref(false) + + +// 查询条件 +const queryParams = reactive({ + warehouse_id: '', + supplier_id: '', + store_id: '', + order_type: '', + product_id: '', + oid: '', + code: '', + pay_type: '', + status: '', +}) + +// 选中数据 +const selectData = ref<any[]>([]) + +// 表格选择后回调事件 +const handleSelectionChange = (val: any[]) => { + selectData.value = val.map(({ id }) => id) +} + +// 获取字典数据 +const { dictData } = useDictData('product_type') + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: apiPsiWarehouseProductLists, + params: queryParams +}) + +// 添加 +const handleAdd = async () => { + showEdit.value = true + await nextTick() + editRef.value?.open('add') +} + +// 编辑 +const handleEdit = async (data: any) => { + showEdit.value = true + await nextTick() + editRef.value?.open('edit') + editRef.value?.setFormData(data) +} + +// 删除 +const handleDelete = async (id: number | any[]) => { + await feedback.confirm('确定要删除?') + await apiPsiWarehouseProductDelete({ id }) + getLists() +} + +getLists() +</script> +