This commit is contained in:
mkm 2024-08-20 18:05:40 +08:00
parent 45ca2e5e39
commit 92c33ab521
9 changed files with 926 additions and 13 deletions

View File

@ -0,0 +1,38 @@
import request from '@/utils/request'
// 商品仓储订单列表
export function apiWarehouseOrderLists(params: any) {
return request.get({ url: '/warehouse_order/warehouseorder/lists', params })
}
// 添加商品仓储订单
export function apiWarehouseOrderAdd(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/add', params })
}
// 添加出库单
export function apiWarehouseOrderOutbound(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/outbound', params })
}
// 编辑商品仓储订单
export function apiWarehouseOrderEdit(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/edit', params })
}
// 删除商品仓储订单
export function apiWarehouseOrderDelete(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/delete', params })
}
// 商品仓储订单详情
export function apiWarehouseOrderDetail(params: any) {
return request.get({ url: '/warehouse_order/warehouseorder/detail', params })
}
// 导出商品仓储入库订单
export function apiWarehouseOrderRentryExport(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/rentry_export', params })
}
// 导出商品仓储出库订单
export function apiWarehouseOrderExport(params: any) {
return request.post({ url: '/warehouse_order/warehouseorder/export', params })
}

View File

@ -2,15 +2,18 @@
<el-drawer v-model="showDialog" title="订单详情" :size="1000"> <el-drawer v-model="showDialog" title="订单详情" :size="1000">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div>订单编号{{ formData.order_id }}</div> <div>订单编号{{ formData.order_id }}</div>
<el-button v-perms="['store_order.store_order/refund']" @click="command(1)">
立即退款
</el-button>
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<el-button></el-button> <el-button></el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item <!-- <el-dropdown-item
v-perms="['store_order.store_order/refund']" v-perms="['store_order.store_order/refund']"
@click="command(1)" @click="command(1)"
>立即退款</el-dropdown-item >立即退款</el-dropdown-item
> > -->
<!-- <el-dropdown-item @click="prints()">打印</el-dropdown-item> --> <!-- <el-dropdown-item @click="prints()">打印</el-dropdown-item> -->
<el-dropdown-item @click="xlsx(formData.id, formData.order_id)" <el-dropdown-item @click="xlsx(formData.id, formData.order_id)"
>导出</el-dropdown-item >导出</el-dropdown-item

View File

@ -1,6 +1,6 @@
<template> <template>
<el-card> <el-card>
<div class="mb-4 text-lg font-bold">导入商品到门店</div> <div class="mb-4 text-lg font-bold">出库商品到门店</div>
<div> <div>
<el-form ref="formRef" :model="formData" label-width="90px"> <el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="仓库" prop="uid"> <el-form-item label="仓库" prop="uid">
@ -13,6 +13,21 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="送货时间">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="formData.manufacture"
clearable
type="datetime"
value-format="YYYY-MM-DD"
placeholder="选择生产日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="formData.remark" type="input" rows="4" />
</el-form-item>
<el-form-item label="门店" prop="store_id"> <el-form-item label="门店" prop="store_id">
<div class="flex-1 w-full"> <div class="flex-1 w-full">
<div class="mb-2"> <div class="mb-2">
@ -160,7 +175,7 @@
<script lang="ts" setup name="storeProductEdit"> <script lang="ts" setup name="storeProductEdit">
import { ElMessage, type FormInstance } from 'element-plus' import { ElMessage, type FormInstance } from 'element-plus'
import useMultipleTabs from '@/hooks/useMultipleTabs' import useMultipleTabs from '@/hooks/useMultipleTabs'
import { apiStoreProductImport } from '@/api/store_product' import { apiWarehouseOrderOutbound } from '@/api/warehouse_order'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import { onMounted } from 'vue' import { onMounted } from 'vue'
@ -186,7 +201,9 @@ const stock = ref(0)
// //
const formData = reactive({ const formData = reactive({
store_id: '' store_id: '',
manufacture: '',
remark: ''
}) })
if (route.query.warehouse_id) { if (route.query.warehouse_id) {
warehouse_id.value = parseInt(route.query.warehouse_id) warehouse_id.value = parseInt(route.query.warehouse_id)
@ -289,18 +306,24 @@ const handleSubmit = async () => {
} }
}) })
const store_arr = storeList.value.map((item: any) => item.id) const store_arr = storeList.value.map((item: any) => item.id)
apiStoreProductImport({ if (store_arr.length > 1) {
ElMessage.error('门店不能超过一个')
return
}
apiWarehouseOrderOutbound({
product_arr, product_arr,
store_arr, store_arr,
stock_type: stock_type.value, stock_type: stock_type.value,
warehouse_id: warehouse_id.value warehouse_id: warehouse_id.value,
delivery_time: formData.manufacture,
mark: formData.remark
}).then((res) => { }).then((res) => {
// removeTab() // removeTab()
// if (res.code == 1) { // if (res.code == 1) {
// ElMessage.success(res.msg) // ElMessage.success(res.msg)
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/warehouse/outbound_list' path: '/warehouse/outbound_order'
}) })
}, 2000) }, 2000)
// } else { // } else {

View File

@ -0,0 +1,149 @@
<template>
<el-drawer v-model="showDialog" title="订单详情" :size="1200">
<div class="flex items-center justify-between m-4">
<div class="flex flex-col">
<div style="color: gray">仓库</div>
<div style="color: black">{{ formData.warehouse_name }}</div>
</div>
<div class="flex flex-col" v-if="formData.financial_pm == 1">
<div style="color: gray">供应商</div>
<div style="color: black">{{ formData.supplier_name }}</div>
</div>
<div class="flex flex-col" v-else>
<div style="color: gray">门店</div>
<div style="color: black">{{ formData.system_store }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">单号</div>
<div style="color: black">{{ formData.code }}</div>
</div>
</div>
<div class="flex items-center justify-between m-4">
<div class="flex flex-col">
<div style="color: gray">总价</div>
<div style="color: black">{{ formData.total_price }}</div>
</div>
<div class="flex flex-col flex-2">
<div style="color: gray">时间</div>
<div style="color: black">{{ formData.create_time }}</div>
</div>
<el-button @click="xlsx(formData.id)"> 打印 </el-button>
</div>
<el-tabs v-model="activeName" class="demo-tabs" type="border-card">
<el-tab-pane label="明细" name="second">
<div>
<div>
<el-table :data="pager.lists" v-loading="pager.loading">
<el-table-column
label="商品信息"
prop="store_name"
show-overflow-tooltip
>
<template #default="{ row }">
<div class="flex items-center">
<el-image
:src="row.image"
class="w-16 h-16 mr-2"
:preview-teleported="true"
></el-image>
<div>{{ row.store_name }}</div>
</div>
</template>
</el-table-column>
<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>
</div>
<div class="flex mt-4 justify-end" v-if="pager.lists.length < pager.count">
<pagination v-model="pager" @change="getLists" />
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-drawer>
</template>
<script lang="ts" setup name="storeOrderDETAILS">
import { ElMessage, type FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiWarehouseProductLists } from '@/api/warehouse_product'
import { apiWarehouseOrderRentryExport, apiWarehouseOrderExport } from '@/api/warehouse_order'
import type { PropType } from 'vue'
import { usePaging } from '@/hooks/usePaging'
import { useRoute } from 'vue-router'
const route = useRoute()
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const showDialog = ref(false)
const activeName = ref('second')
//
const formData = ref({
id: '',
code: '',
total_price: '',
supplier_name: '',
warehouse_name: '',
system_store: '',
financial_pm: ''
})
const queryParams = reactive({
oid: '',
pay_type: ''
})
//
const setFormData = async (data: Record<any, any>) => {
formData.value = { ...data }
}
const getDetail = async (row: Record<string, any>) => {
formData.value = { ...row }
queryParams.oid = row.id
// setFormData(data)
getLists()
}
const xlsx = (id) => {
if (formData.value.financial_pm == 1) {
apiWarehouseOrderRentryExport({
id: id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
} else {
apiWarehouseOrderExport({
id: id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
}
//
const open = () => {
showDialog.value = true
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseProductLists,
params: queryParams
})
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,164 @@
<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="code">
<el-input v-model="formData.code" clearable placeholder="请输入单号" :readonly="false"/>
</el-form-item>
<el-form-item label="0 = 出库 1 = 获得" prop="financial_pm">
<el-input v-model="formData.financial_pm" clearable placeholder="请输入0 = 出库 1 = 获得" :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="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="status">
<el-input v-model="formData.status" clearable placeholder="请输入状态" :readonly="false"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="warehouseOrderEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiWarehouseOrderAdd, apiWarehouseOrderEdit, apiWarehouseOrderDetail } from '@/api/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: '',
code: '',
financial_pm: '',
admin_id: '',
batch: '',
mark: '',
purchase: '',
total_price: '',
status: '',
})
//
const formRules = reactive<any>({
warehouse_id: [{
required: true,
message: '请输入仓库',
trigger: ['blur']
}],
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 apiWarehouseOrderDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiWarehouseOrderEdit(data)
: await apiWarehouseOrderAdd(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>

View File

@ -0,0 +1,266 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="门店名称" prop="store_id">
<div class="flex items-center mr-4">
<el-select
v-model="queryParams.store_id"
filterable
remote
reserve-keyword
placeholder="输入门店名称搜索"
remote-show-suffix
:remote-method="remoteMethod"
:loading="storeloading"
style="width: 240px"
@change="resetPage"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</div>
</el-form-item>
<el-form-item label="仓库ID" 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-select
v-model="queryParams.supplier_id"
filterable
remote
reserve-keyword
placeholder="输入供应商名称搜索"
remote-show-suffix
:remote-method="remoteMethodUser"
:loading="userloading"
style="width: 240px"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.mer_name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="商品" prop="product_name">
<el-input
class="w-[280px]"
v-model="queryParams.product_name"
clearable
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="日期" prop="create_time">
<el-date-picker
v-model="startEndTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
unlink-panels
@change="changeStartEndTime"
/>
</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">
<router-link
:to="{
path: 'warehousing'
}"
class="ml-4"
>
<el-button type="primary"> 入库 </el-button>
</router-link>
<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 width="55" />
<el-table-column label="操作时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
<el-table-column label="单号" prop="code" show-overflow-tooltip />
<el-table-column label="状态" prop="financial_pm_name" show-overflow-tooltip />
<el-table-column label="填写人员" prop="admin_name" show-overflow-tooltip />
<!-- <el-table-column label="批次" prop="batch" 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="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="handleDetai(row)"
>详情</el-button
>
<el-button
v-perms="['warehouse_order.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"
/>
<details-popup
v-if="showDetails"
ref="detailsRef"
@success="getLists"
@close="showDetails = false"
:dictData="dictData"
/>
</div>
</template>
<script lang="ts" setup name="warehouseOrderLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseOrderLists, apiWarehouseOrderDelete } from '@/api/warehouse_order'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailsPopup from './details.vue'
import { apiSystemStoreLists } from '@/api/system_store'
import moment from 'moment'
import { apiSupplierLists } from '@/api/supplier'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailsRef = shallowRef<InstanceType<typeof DetailsPopup>>()
//
const showEdit = ref(false)
const showDetails = ref(false)
//
const queryParams = reactive({
warehouse_id: '',
product_name: '',
financial_pm: 1,
store_id: '',
start_time: '',
end_time: '',
supplier_id: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseOrderLists,
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 apiWarehouseOrderDelete({ id })
getLists()
}
//
const handleDetai = async (data: any) => {
showDetails.value = true
await nextTick()
detailsRef.value?.open()
detailsRef.value?.getDetail(data)
}
const startEndTime = ref([])
const changeStartEndTime = () => {
if (startEndTime.value[0] && startEndTime.value[1]) {
queryParams.start_time = moment(startEndTime.value[0]).format('YYYY-MM-DD') + ' 00:00:00'
queryParams.end_time = moment(startEndTime.value[1]).format('YYYY-MM-DD') + ' 23:59:59'
} else {
queryParams.start_time = ''
queryParams.end_time = ''
}
getLists()
}
const storeloading = ref(false)
const storeList = ref([])
const remoteMethod = (e = '') => {
storeloading.value = true
apiSystemStoreLists({
name: e,
page_size: 50
})
.then((res) => {
storeList.value = res.lists
setTimeout(() => {
storeloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
storeloading.value = false
}, 300)
})
}
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
apiSupplierLists({})
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
getLists()
</script>

View File

@ -0,0 +1,266 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="门店名称" prop="store_id">
<div class="flex items-center mr-4">
<el-select
v-model="queryParams.store_id"
filterable
remote
reserve-keyword
placeholder="输入门店名称搜索"
remote-show-suffix
:remote-method="remoteMethod"
:loading="storeloading"
style="width: 240px"
@change="resetPage"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</div>
</el-form-item>
<el-form-item label="仓库ID" 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-select
v-model="queryParams.supplier_id"
filterable
remote
reserve-keyword
placeholder="输入供应商名称搜索"
remote-show-suffix
:remote-method="remoteMethodUser"
:loading="userloading"
style="width: 240px"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.mer_name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="商品" prop="product_name">
<el-input
class="w-[280px]"
v-model="queryParams.product_name"
clearable
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="日期" prop="create_time">
<el-date-picker
v-model="startEndTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
unlink-panels
@change="changeStartEndTime"
/>
</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">
<router-link
:to="{
path: 'import'
}"
class="ml-4"
>
<el-button type="primary"> 出库 </el-button>
</router-link>
<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 width="55" />
<el-table-column label="操作时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="门店" prop="system_store" show-overflow-tooltip />
<el-table-column label="单号" prop="code" show-overflow-tooltip />
<el-table-column label="状态" prop="financial_pm_name" show-overflow-tooltip />
<el-table-column label="填写人员" prop="admin_name" show-overflow-tooltip />
<!-- <el-table-column label="批次" prop="batch" 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="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="handleDetai(row)"
>详情</el-button
>
<el-button
v-perms="['warehouse_order.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"
/>
<details-popup
v-if="showDetails"
ref="detailsRef"
@success="getLists"
@close="showDetails = false"
:dictData="dictData"
/>
</div>
</template>
<script lang="ts" setup name="warehouseOrderLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiWarehouseOrderLists, apiWarehouseOrderDelete } from '@/api/warehouse_order'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailsPopup from './details.vue'
import { apiSystemStoreLists } from '@/api/system_store'
import moment from 'moment'
import { apiSupplierLists } from '@/api/supplier'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailsRef = shallowRef<InstanceType<typeof DetailsPopup>>()
//
const showEdit = ref(false)
const showDetails = ref(false)
//
const queryParams = reactive({
warehouse_id: '',
product_name: '',
financial_pm: 0,
store_id: '',
start_time: '',
end_time: '',
supplier_id: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseOrderLists,
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 apiWarehouseOrderDelete({ id })
getLists()
}
//
const handleDetai = async (data: any) => {
showDetails.value = true
await nextTick()
detailsRef.value?.open()
detailsRef.value?.getDetail(data)
}
const startEndTime = ref([])
const changeStartEndTime = () => {
if (startEndTime.value[0] && startEndTime.value[1]) {
queryParams.start_time = moment(startEndTime.value[0]).format('YYYY-MM-DD') + ' 00:00:00'
queryParams.end_time = moment(startEndTime.value[1]).format('YYYY-MM-DD') + ' 23:59:59'
} else {
queryParams.start_time = ''
queryParams.end_time = ''
}
getLists()
}
const storeloading = ref(false)
const storeList = ref([])
const remoteMethod = (e = '') => {
storeloading.value = true
apiSystemStoreLists({
name: e,
page_size: 50
})
.then((res) => {
storeList.value = res.lists
setTimeout(() => {
storeloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
storeloading.value = false
}, 300)
})
}
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
apiSupplierLists({})
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
getLists()
</script>

View File

@ -110,14 +110,14 @@
> >
删除 --> 删除 -->
<!-- </el-button> --> <!-- </el-button> -->
<router-link <!-- <router-link
:to="{ :to="{
path: 'warehousing' path: 'warehousing'
}" }"
class="ml-4" class="ml-4"
> >
<el-button type="primary"> 入库 </el-button> <el-button type="primary"> 入库 </el-button>
</router-link> </router-link> -->
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />

View File

@ -45,6 +45,9 @@
<el-form-item label="总价" prop="total_price"> <el-form-item label="总价" prop="total_price">
<span>{{ formData.total_price }}</span> <span>{{ formData.total_price }}</span>
</el-form-item> </el-form-item>
<el-form-item label="备注">
<el-input v-model="formData.remark" type="input" rows="4" />
</el-form-item>
<el-form-item label="商品" prop="store_id"> <el-form-item label="商品" prop="store_id">
<div class="flex-1 w-full"> <div class="flex-1 w-full">
<div class="mb-2"> <div class="mb-2">
@ -153,7 +156,7 @@ import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import { onMounted } from 'vue' import { onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { apiWarehouseProductAdd } from '@/api/warehouse_product' import { apiWarehouseOrderAdd } from '@/api/warehouse_order'
import { apiWarehouseLists } from '@/api/warehouse' import { apiWarehouseLists } from '@/api/warehouse'
import { apiSupplierLists } from '@/api/supplier' import { apiSupplierLists } from '@/api/supplier'
@ -176,7 +179,8 @@ const formData = reactive({
warehouse_id: '', warehouse_id: '',
supplier_id: '', supplier_id: '',
code: '', code: '',
total_price: 0 total_price: 0,
remark: ''
}) })
const warehouse = () => { const warehouse = () => {
@ -238,7 +242,7 @@ const handleSubmit = async () => {
expiration_date: item.expiration_date expiration_date: item.expiration_date
} }
}) })
apiWarehouseProductAdd({ apiWarehouseOrderAdd({
product_arr, product_arr,
...formData ...formData
}).then((res) => { }).then((res) => {