feat(psi): 添加商品仓储订单相关功能

- 新增商品仓储订单列表、添加、编辑、删除等接口
- 实现供应商户表和门店列表的相关接口
- 添加商品仓储订单复制、编辑、删除等功能组件
- 实现订单流程 drawers 和完结功能
This commit is contained in:
mkm 2025-02-28 16:04:28 +08:00
parent 764e8f48bf
commit b4ac918ded
17 changed files with 3409 additions and 0 deletions

42
src/api/psi/psi_order.ts Normal file
View File

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

26
src/api/supplier.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 供应商户表列表
export function apiSupplierLists(params: any) {
return request.get({ url: '/supplier/supplier/lists', params })
}
// 添加供应商户表
export function apiSupplierAdd(params: any) {
return request.post({ url: '/supplier/supplier/add', params })
}
// 编辑供应商户表
export function apiSupplierEdit(params: any) {
return request.post({ url: '/supplier/supplier/edit', params })
}
// 删除供应商户表
export function apiSupplierDelete(params: any) {
return request.post({ url: '/supplier/supplier/delete', params })
}
// 供应商户表详情
export function apiSupplierDetail(params: any) {
return request.get({ url: '/supplier/supplier/detail', params })
}

66
src/api/system_store.ts Normal file
View File

@ -0,0 +1,66 @@
import request from '@/utils/request'
// 门店列表列表
export function apiSystemStoreLists(params: any) {
return request.get({ url: '/system_store/systemstore/lists', params })
}
// 添加门店列表
export function apiSystemStoreAdd(params: any) {
return request.post({ url: '/system_store/systemstore/add', params })
}
// 编辑门店列表
export function apiSystemStoreEdit(params: any) {
return request.post({ url: '/system_store/systemstore/edit', params })
}
// 删除门店列表
export function apiSystemStoreDelete(params: any) {
return request.post({ url: '/system_store/systemstore/delete', params })
}
// 门店列表详情
export function apiSystemStoreDetail(params: any) {
return request.get({ url: '/system_store/systemstore/detail', params })
}
// 根据商品来源获取门店
export function apiSourceProductStoreLists(params: any) {
return request.get({ url: '/system_store/systemstore/source_product_store_lists', params })
}
// 根据商品编辑门店库存
export function apiStoreBranchProductEdit(params: any) {
return request.post({ url: '/store_branch_product/StoreBranchProduct/edit', params })
}
// 根据商品编辑门店库存
export function apiStoreBranchProductEditPrice(params: any) {
return request.post({ url: '/store_branch_product/StoreBranchProduct/edit_price', params })
}
// 运营概况-头部统计
export function apiSystemStoreStatisticsHeader(params: any) {
return request.get({ url: '/system_store/SystemStoreStatistics/header', params })
}
// 运营概况-营业趋势
export function apiSystemStoreStatisticsOperate(params: any) {
return request.get({ url: '/system_store/SystemStoreStatistics/operate', params })
}
// 运营概况-交易/类型数据
export function apiSystemStoreStatisticsOrderChart(params: any) {
return request.get({ url: '/system_store/SystemStoreStatistics/orderChart', params })
}
// 运营概况-门店业绩
export function apiSystemStoreStatisticsStore(params: any) {
return request.get({ url: '/system_store/SystemStoreStatistics/store', params })
}
// 门店交易统计
export function apiWorkbenchStoreIndex(params: any) {
return request.get({ url: '/workbench/store_index', params })
}

View File

@ -0,0 +1,2 @@
<template><div></div></template>
<script setup lang="ts"></script>

View File

@ -0,0 +1,77 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" title="复制订单" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="门店" prop="store_id" style="width: 300px">
<el-select v-model="formData.store_id" filterable remote reserve-keyword placeholder="输入门店名称搜索"
remote-show-suffix :remote-method="remoteMethod" :loading="storeloading" style="width: 240px">
<el-option v-for="item in storeList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input v-model="formData.mark" 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 {
apiBeforehandOrderCopy
} from '@/api/beforehand_order'
import { apiSystemStoreLists } from '@/api/system_store'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
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)
})
}
//
const formData = reactive({
id: '',
store_id: '',
mark: ''
})
//
const handleSubmit = async () => {
const data = { ...formData }
await apiBeforehandOrderCopy(data)
popupRef.value?.close()
emit('success')
}
//
const open = (id) => {
formData.id = id
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open
})
</script>

View File

@ -0,0 +1,170 @@
<template>
<div>
<el-form class="inline-block" :model="queryParams" inline>
<el-form-item label="名称" prop="store_name">
<el-input
class="w-[280px]"
v-model="queryParams.store_name"
clearable
placeholder="请输入名称"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<export-data
class="ml-2.5"
:fetch-fun="apiPurchaseProductOfferLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
<el-button
type="primary"
@click="OclickDialogBuyer"
v-perms="['beforehand_order.beforehand_order/oneClickStorage']"
class="mb-4"
>
一键报损
</el-button>
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="60" />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="原因" prop="mark" show-overflow-tooltip />
<el-table-column label="操作" fixed="right" width="180">
<template #default="{ row }">
<el-button
type="primary"
link
@click="resetWarehouseClick(row)"
v-perms="['warehouse_product.warehouse_product/resetNums']"
>重置数量</el-button
>
<el-button
type="danger"
link
@click="handleDelete(row.id)"
v-perms="['purchase_product_offer.purchase_product_offer/delete']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
</div>
</div>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiPurchaseProductOfferLists,
apiPurchaseProductOfferDelete
} from '@/api/purchase_product_offer'
import { apiBeforehandOrderCartInfoOneClickStorage } from '@/api/beforehand_order_cart_info'
import { apiWarehouseLists } from '@/api/warehouse'
import { apiSupplierLists } from '@/api/supplier'
import { useDictData } from '@/hooks/useDictOptions'
import feedback from '@/utils/feedback'
const order_id = ref({ id: 0 })
const dialogBuyer = ref(false)
const warehouse_list = ref([])
const resetWarehouseShow = ref(false)
const one_click_storage = ref({
bhoid: order_id.value.id,
warehouse_id: '',
remark: ''
})
const formData = ref({
id: '',
bhoid: order_id.value.id,
supplier_id: '',
purchase: 0,
outbound_price: 0,
total_price: 0,
buyer_nums: 0,
package: '',
store_info: '',
marques: '',
after_sales: '',
pay_type: 1
})
const resetWarehouseData = ref({
id: '',
store_name: '',
nums: ''
})
const resetWarehouseClick = (data: any) => {
resetWarehouseShow.value = true
resetWarehouseData.value.id = data.id
resetWarehouseData.value.store_name = data.store_name
resetWarehouseData.value.nums = data.nums
}
const OclickDialogBuyer = () => {
dialogBuyer.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
}
const queryParams = reactive({
order_id: order_id.value.id,
store_name: '',
is_adopt: '',
is_mer: 1
})
const supplierLoading = ref(false)
const supplierList = ref([])
const remoteMethodSupplier = (e = '') => {
supplierLoading.value = true
apiSupplierLists({ mer_name: e })
.then((res) => {
supplierList.value = res.lists
setTimeout(() => {
supplierLoading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
supplierLoading.value = false
}, 300)
})
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiPurchaseProductOfferLists,
params: queryParams
})
//
const { dictData } = useDictData('outbound_floating')
function getList(id) {
order_id.value.id = id
one_click_storage.value.bhoid = id
formData.value.bhoid = id
queryParams.order_id = id
getLists()
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiPurchaseProductOfferDelete({ id })
getLists()
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,151 @@
<template>
<el-drawer title="订单流程" v-model="visible" :size="700">
<el-card class="step-card mb-1" v-for="item in dataList">
<el-row>
<el-form-item label="用户" prop="nickname">
<el-input v-model="item.admin.name" type="input" disabled />
</el-form-item>
</el-row>
<el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="item.remark" type="input" />
</el-form-item>
</el-row>
<el-row>
<el-form-item label="图片" prop="images">
<div v-for="image in item.images">
<el-image :src="image" style="width: 120px; height: 120px" :preview-src-list="item.images" />
</div>
</el-form-item>
</el-row>
<el-form-item v-if="item.status == 0" label="">
<el-button @click="handleConfirm(item)" type="primary" class="w-40">确认</el-button>
</el-form-item>
</el-card>
<el-card class="step-card mt-1" v-if="!auditStatus">
<el-form ref="formRef" :model="formData" label-width="90px">
<el-row>
<el-form-item label="用户" prop="admin_id">
<el-select v-model="formData.admin_id" filterable remote reserve-keyword placeholder="输入用户名称搜索"
remote-show-suffix :remote-method="remoteMethodUser" :loading="userloading"
style="width: 220px">
<el-option v-for="item in userList" :key="item.id"
:label="`${item.name}|${item.account} (ID:${item.id})`" :value="item.id" />
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" type="input" />
</el-form-item>
</el-row>
<el-row>
<el-form-item label="图片" prop="images">
<material-picker v-model="formData.images" :limit="20" />
</el-form-item>
</el-row>
<el-form-item label="">
<el-button @click="handleSubmit" type="primary" class="w-40">提交</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="step-card mt-1" v-if="!auditStatus">
<el-button @click="handleSettle" type="primary" class="w-40">完结</el-button>
</el-card>
</el-drawer>
</template>
<script lang="ts" setup>
import { defineProps, defineEmits, type FormInstance } from 'vue'
import {
apiBeforehandOrderLogLists,
apiBeforehandOrderLogSave,
apiBeforehandOrderSettle,
apiBeforehandOrderLogConfirm
} from '@/api/beforehand_order'
import { Plus } from '@element-plus/icons-vue'
import type { UploadProps, UploadUserFile } from 'element-plus'
import { adminLists } from '@/api/perms/admin'
const props = defineProps({
modelValue: {
type: Boolean,
required: true
}
})
const emit = defineEmits(['update:modelValue'])
const visible = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
const formData = reactive({
order_id: '',
images: [],
remark: '',
admin_id: ''
})
const formRef = shallowRef<FormInstance>()
const handleSubmit = async () => {
await formRef.value?.validate()
const data : any = { ...formData }
await apiBeforehandOrderLogSave(data)
handleClose()
}
const fileList = ref([])
const auditStatus = ref(false)
const dataList = ref([])
const open = (id) => {
formData.order_id = id
auditStatus.value = false
dataList.value = []
apiBeforehandOrderLogLists({ order_id: id }).then((res : any) => {
if (res.audit_status == 1) {
auditStatus.value = true
}
dataList.value = res.list
})
}
const handleClose = () => {
emit('close')
}
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
adminLists({
name: e,
page_size: 10
})
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
const handleConfirm = async (row) => {
await apiBeforehandOrderLogConfirm(row)
emit('close')
}
const handleSettle = async () => {
await apiBeforehandOrderSettle({ id: formData.order_id })
emit('close')
}
defineExpose({
open
})
</script>

View File

@ -0,0 +1,141 @@
<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="store_name">
<el-input v-model="formData.store_name" disabled />
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="formData.nums"
clearable
placeholder="请输入数量"
:readonly="false"
@change="compute"
/>
</el-form-item>
<el-form-item label="零售价" prop="purchases">
<el-input
v-model="formData.purchases"
clearable
placeholder="请输入价格"
:readonly="false"
@change="compute"
:disabled="formData.type == 0"
/>
</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="mark">
<el-input
v-model="formData.mark"
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 {
apiBeforehandOrderCartInfoEdit,
apiBeforehandOrderCartInfoDetail
} from '@/api/beforehand_order_cart_info'
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: '',
bhoid: '',
type: 0,
store_name: '',
total_price: '',
nums: '',
purchases: '',
mark: ''
})
//
const formRules = reactive<any>({})
const compute = () => {
formData.total_price = (formData.nums * formData.purchases).toFixed(2)
}
//
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]
}
}
formData.nums = data.cart_num
formData.purchases = data.price
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiBeforehandOrderCartInfoDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData }
await apiBeforehandOrderCartInfoEdit(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,547 @@
<template>
<div>
<el-form class="inline-block" :model="queryParams" inline>
<el-form-item label="名称" prop="store_name">
<el-input
class="w-[280px]"
v-model="queryParams.store_name"
clearable
placeholder="请输入名称"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<export-data
class="ml-2.5"
:fetch-fun="apiPurchaseProductOfferLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
<el-button type="primary" @click="no_storage(0)" class="mb-4"> 未入库 </el-button>
<el-button type="primary" @click="no_storage(1)" class="mb-4"> 已入库 </el-button>
<!-- <el-button
type="primary"
@click="OclickDialogBuyer"
v-perms="['beforehand_order.beforehand_order/oneClickStorage']"
class="mb-4"
>
一键入库
</el-button> -->
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="60" />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
<el-table-column label="需求数量" prop="need_num" show-overflow-tooltip />
<el-table-column label="采购数量" prop="buyer_nums" show-overflow-tooltip />
<el-table-column label="采购价" prop="price" show-overflow-tooltip />
<el-table-column label="采购总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip />
<el-table-column label="采购状态" prop="buyer_confirm_name" show-overflow-tooltip />
<el-table-column label="支付方式" prop="pay_type_name" show-overflow-tooltip />
<el-table-column label="是否入库" prop="is_storage_name" show-overflow-tooltip />
<el-table-column label="来源订单信息" prop="unit_name" show-overflow-tooltip>
<template #default="{ row }">
<div v-for="item in row.source_order_info">
<div>订单id{{ item.source_order_id }}</div>
<div>数量{{ item.need_num }}</div>
<div>订单备注{{ item.mark }}</div>
</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="180">
<template #default="{ row }">
<el-button
v-if="row.is_storage == 0"
type="primary"
link
@click="procureClick(row)"
>采购设置</el-button
>
<el-button
v-if="row.is_storage == 0"
type="primary"
link
v-perms="['beforehand_order.beforehand_order/oneClickStorage']"
@click="storeroomClick(row)"
>分拣入库</el-button
>
<!-- <el-button
type="primary"
link
@click="productOfferClick(row)"
v-perms="['purchase_product_offer.purchase_product_offer/warehouse']"
>修改入库</el-button
> -->
<el-button
type="danger"
link
@click="handleDelete(row.id)"
v-perms="['purchase_product_offer.purchase_product_offer/delete']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<!-- <div class="flex mt-4 justify-end">
<pagination
v-if="pager.lists"
v-model="pager"
@change="getLists"
/>
</div> -->
</div>
<el-dialog v-model="dialogBuyer" title="入库设置" width="600">
<el-form ref="formRef" :model="one_click_storage" label-width="90px">
<el-form-item label="仓库">
<el-select
v-model="one_click_storage.warehouse_id"
placeholder="请选择仓库"
size="large"
style="width: 240px"
>
<el-option
v-for="item in warehouse_list"
:label="item.name"
:value="item.id"
:key="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="one_click_storage.remark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogBuyer = false">取消</el-button>
<el-button type="primary" @click="oneClickStorage" :disabled="disableClick">
确认
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="procureShow" title="采购设置" width="600">
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="供应商">
<el-select
v-model="formData.supplier_id"
filterable
reserve-keyword
placeholder="输入供应商名称搜索"
style="width: 240px"
>
<el-option
v-for="item in supplierList"
:key="item.id"
:label="item.mer_name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数量" prop="buyer_nums">
<el-input
v-model="formData.buyer_nums"
clearable
placeholder="请输入采购数量"
:readonly="false"
@change="compute"
/>
</el-form-item>
<!-- <el-form-item label="采购价" prop="purchase_price">
<el-input
v-model="formData.purchase_price"
clearable
placeholder="请输入采购价"
:readonly="false"
/>
</el-form-item>
<el-form-item label="采购净价" prop="purchase">
<el-input
v-model="formData.purchase"
clearable
placeholder="请输入采购净价"
:readonly="false"
disabled
/>
</el-form-item> @change="compute"
-->
<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="pay_type">
<el-radio-group v-model="formData.pay_type">
<el-radio :label="1">赊账</el-radio>
<el-radio :label="2">现金</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="包装" prop="package">
<el-input v-model="formData.package" placeholder="请输入包装" />
</el-form-item>
<el-form-item label="规格" prop="store_info">
<el-input v-model="formData.store_info" placeholder="请输入规格" />
</el-form-item>
<el-form-item label="型号" prop="marques">
<el-input v-model="formData.marques" placeholder="请输入型号" />
</el-form-item>
<el-form-item label="售后" prop="after_sales">
<el-input v-model="formData.after_sales" placeholder="请输入售后" />
</el-form-item>
<el-form-item label="生产日期" prop="manufacture">
<el-date-picker
v-model="formData.manufacture"
type="date"
value-format="YYYY-MM-DD"
placeholder="请输入生产日期"
/>
</el-form-item>
<el-form-item label="保质期" prop="expiration_date">
<el-date-picker
v-model="formData.expiration_date"
type="date"
value-format="YYYY-MM-DD"
placeholder="请输入保质期"
/>
</el-form-item> -->
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="procureShow = false">取消</el-button>
<el-button type="primary" @click="setProcureInfo"> 确认 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="storeroomShow" title="分拣设置" width="600">
<el-form ref="formRef" :model="storeroom" label-width="90px">
<el-form-item label="仓库">
<el-select
v-model="storeroom.warehouse_id"
placeholder="请选择仓库"
size="large"
style="width: 240px"
>
<el-option
v-for="item in warehouse_list"
:label="item.name"
:value="item.id"
:key="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="采购数量" prop="buyer_nums">
<el-input v-model="storeroom.buyer_nums" readonly />
</el-form-item>
<el-form-item label="分拣数量" prop="warehouse_num">
<el-input
v-model="storeroom.warehouse_num"
clearable
placeholder="请输入分拣数量"
:readonly="false"
@change="compute"
/>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="storeroom.mark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="storeroomShow = false">取消</el-button>
<el-button type="primary" @click="putInStorage" :disabled="disableClick">
确认
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="productOfferShow" title="入库设置" width="600">
<el-form ref="formRef" :model="productOfferData" label-width="90px">
<el-form-item label="采购数量" prop="buyer_nums">
<el-input
v-model="productOfferData.buyer_nums"
clearable
placeholder="请输入采购数量"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="productOfferShow = false">取消</el-button>
<el-button type="primary" @click="productOfferInfo"> 确认 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiPurchaseProductOfferLists,
apiPurchaseProductOfferSetProcureInfo,
apiPurchaseProductOffersetStoreroomInfo,
apiPurchaseProductOffersetStoreroomInfoTwo,
apiPurchaseProductOfferDelete
} from '@/api/purchase_product_offer'
import {
apiBeforehandOrderCartInfoOneClickStorage,
apiBeforehandOrderCartInfoPutInStorage
} from '@/api/beforehand_order_cart_info'
import { apiWarehouseLists } from '@/api/warehouse'
import { apiSupplierLists } from '@/api/supplier'
import { useDictData } from '@/hooks/useDictOptions'
import feedback from '@/utils/feedback'
const order_id = ref({ id: 0 })
const outbound_lv = ref('')
const dialogBuyer = ref(false)
const procureShow = ref(false)
const storeroomShow = ref(false)
const productOfferShow = ref(false)
const warehouse_list = ref([])
const disableClick = ref(false)
const one_click_storage = ref({
bhoid: order_id.value.id,
warehouse_id: '',
remark: ''
})
const formData = ref({
id: '',
bhoid: order_id.value.id,
supplier_id: '',
purchase: 0,
purchase_price: 0,
outbound_price: 0,
total_price: 0,
buyer_nums: 0,
package: '',
store_info: '',
marques: '',
after_sales: '',
pay_type: 1,
manufacture: '',
expiration_date: ''
})
const storeroom = ref({
id: '',
bhoid: order_id.value.id,
product_id: '',
buyer_nums: '',
warehouse_num: '',
warehouse_id: '',
mark: ''
})
const productOfferData = ref({
id: '',
buyer_nums: ''
})
const no_storage = (type: any) => {
queryParams.is_storage = type
getLists()
}
//
const resetFormData = () => {
formData.value = {
id: '',
bhoid: order_id.value.id,
supplier_id: '',
purchase: 0,
purchase_price: 0,
outbound_price: 0,
total_price: 0,
buyer_nums: 0,
package: '',
store_info: '',
marques: '',
after_sales: '',
pay_type: 1,
manufacture: '',
expiration_date: ''
}
}
const oneClickStorage = async () => {
disableClick.value = true
try {
await apiBeforehandOrderCartInfoOneClickStorage(one_click_storage.value)
dialogBuyer.value = false
disableClick.value = false
getLists()
} catch (error) {
setTimeout(() => {
disableClick.value = false
}, 2000)
}
}
/**
* 采购信息设置
*/
const setProcureInfo = () => {
apiPurchaseProductOfferSetProcureInfo(formData.value).then((res) => {
procureShow.value = false
resetFormData()
getLists()
})
}
const putInStorage = () => {
try {
apiBeforehandOrderCartInfoPutInStorage(storeroom.value).then((res) => {
storeroomShow.value = false
disableClick.value = false
getLists()
})
} catch (error) {
setTimeout(() => {
disableClick.value = false
}, 2000)
}
}
/**
* 库房信息设置
*/
const setStoreroomInfo = () => {
apiPurchaseProductOffersetStoreroomInfo(storeroom.value).then((res) => {
storeroomShow.value = false
resetFormData()
getLists()
})
}
const productOfferInfo = () => {
apiPurchaseProductOffersetStoreroomInfoTwo(productOfferData.value).then((res) => {
productOfferShow.value = false
resetFormData()
getLists()
})
}
const procureClick = (data: any) => {
if (supplierList.value.length <= 0) {
apiSupplierLists({ page_size: 999 }).then((res) => {
supplierList.value = res.lists
})
}
formData.value.id = data.id
formData.value.buyer_nums = data.need_num
formData.value.purchase = data.price
formData.value.total_price = data.total_price
formData.value.package = data.package
formData.value.store_info = data.store_info
formData.value.marques = data.marques
formData.value.after_sales = data.after_sales
formData.value.pay_type = data.pay_type
formData.value.supplier_id = data.supplier_id
formData.value.manufacture = data.manufacture
formData.value.expiration_date = data.expiration_date
dictData.outbound_floating.forEach((item) => {
if (item.value == data.top_cate_name) {
outbound_lv.value = `${item.name}|${item.value}`
}
})
procureShow.value = true
}
const storeroomClick = (data: any) => {
storeroom.value.id = data.id
storeroom.value.bhoid = data.order_id
storeroom.value.product_id = data.product_id
storeroom.value.buyer_nums = data.buyer_nums
storeroom.value.warehouse_num = ''
storeroomShow.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
}
const productOfferClick = (data: any) => {
productOfferData.value.id = data.id
productOfferData.value.buyer_nums = data.buyer_nums
productOfferShow.value = true
}
const compute = () => {
formData.value.purchase = (formData.value.total_price / formData.value.buyer_nums).toFixed(2)
}
const OclickDialogBuyer = () => {
dialogBuyer.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
}
const queryParams = reactive({
order_id: order_id.value.id,
store_name: '',
is_adopt: '',
page_size: 200,
page_no: 1,
is_mer: 1
})
const supplierLoading = ref(false)
const supplierList = ref([])
const remoteMethodSupplier = (e = '') => {
supplierLoading.value = true
apiSupplierLists({ mer_name: e })
.then((res) => {
supplierList.value = res.lists
setTimeout(() => {
supplierLoading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
supplierLoading.value = false
}, 300)
})
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiPurchaseProductOfferLists,
params: queryParams
})
//
const { dictData } = useDictData('outbound_floating')
function getList(id) {
order_id.value.id = id
one_click_storage.value.bhoid = id
formData.value.bhoid = id
queryParams.order_id = id
getLists()
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiPurchaseProductOfferDelete({ id })
getLists()
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,370 @@
<template>
<div>
<el-form class="inline-block" :model="queryParams" inline>
<el-form-item label="名称" prop="store_name">
<el-input
class="w-[280px]"
v-model="queryParams.store_name"
clearable
placeholder="请输入名称"
/>
</el-form-item>
<el-form-item>
<!-- <el-button type="primary" @click="fixAcceptNum">修复分拣数量</el-button> -->
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button type="primary" @click="syncPrice">同步价格</el-button>
<export-data
class="ml-2.5"
:fetch-fun="apiBeforehandOrderCartInfoLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
<el-radio-group v-model="queryParams.top_cate_value" style="margin-left: 30px">
<el-radio
:value="0"
label="全部"
@change="topCateChange({ name: '全部', id: 0 })"
></el-radio>
<el-radio
:value="item.id"
:label="item.name"
v-for="item in formData.top_cate"
:key="item.id"
@change="topCateChange(item)"
></el-radio>
</el-radio-group>
<div>
<el-table :data="pager.lists" v-loading="pager.loading">
<el-table-column label="id" prop="id" show-overflow-tooltip />
<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="top_cate_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="仓库库存" prop="warehouse_stock" show-overflow-tooltip />
<el-table-column label="需要数量" prop="cart_num" show-overflow-tooltip />
<el-table-column label="分拣数量" prop="accept_num" show-overflow-tooltip />
<el-table-column label="零售价" prop="price" show-overflow-tooltip />
<el-table-column label="合计金额" prop="total_price" show-overflow-tooltip />
<el-table-column label="支付金额" prop="pay_price" show-overflow-tooltip />
<el-table-column label="采购订单" prop="procurement_order_id" show-overflow-tooltip>
<template #default="{ row }">
<router-link class="ml-4 text-[#63c869]" :to="{ path: 'beforehand_order_details', query: { id: row.procurement_order_id } }">
{{row.procurement_order_id}}
</router-link>
</template>
</el-table-column>
<el-table-column label="是否门店出货" prop="store_sale" show-overflow-tooltip>
<template #default="{ row }">
<el-switch v-model="row.store_sale" :active-value="1" :inactive-value="0" active-text=""
inactive-text="否" inline-prompt @change="setStoreSale(row.id)" />
</template>
</el-table-column>
<el-table-column
label="是否需采购"
prop="is_buyer"
show-overflow-tooltip
width="120"
>
<template #default="{ row }">
<div v-if="row.is_buyer == 0">
<el-button
type="danger"
round
size="small"
@click="handleBuyer(-1, row)"
></el-button
>
<el-button
type="success"
round
size="small"
@click="handleBuyer(1, row)"
></el-button
>
</div>
<div v-else>
<span v-if="row.is_buyer == 1"
>{{ row.status_name
}}<el-button
type="success"
round
size="small"
@click="handleBuyer(-1, row)"
v-if="row.status_name == '采购中'"
>不采</el-button
></span
>
<span v-if="row.is_buyer == -1"
>无需采购
<el-button
type="success"
round
size="small"
@click="handleBuyer(1, row)"
>重采</el-button
></span
>
</div>
</template>
</el-table-column>
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
link
@click="handleEdit(row, 0)"
v-perms="['beforehand_order_cart_info.beforehand_order_cart_info/edit']"
>
编辑
</el-button>
<el-button
v-perms="[
'beforehand_order_cart_info.beforehand_order_cart_info/edit1'
]"
type="primary"
link
@click="handleEdit(row, 1)"
>
价格编辑
</el-button>
<el-button
v-perms="[
'beforehand_order_cart_info.beforehand_order_cart_info/delete'
]"
type="danger"
link
@click="handleDeletes(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end" v-if="pager.lists.length < pager.count">
<pagination v-model="pager" @change="getLists" />
</div>
<el-dialog v-model="dialogBuyer" title="设置采购" width="600">
<el-form ref="formRef" :model="purchase_product_offer" label-width="120px">
<el-form-item label="采购人员">
<el-select
v-model="purchase_product_offer.buyer_id"
placeholder="请选择采购人员"
size="large"
style="width: 240px"
>
<el-option
v-for="item in delivery_list"
:label="item.nickname"
:value="item.uid"
/>
</el-select>
</el-form-item>
<el-form-item label="采购数量" prop="need_num">
<el-input
v-model="purchase_product_offer.need_num"
clearable
placeholder="请输入采购数量"
:readonly="false"
/>
</el-form-item>
<el-form-item label="是否合并采购" prop="merge_product">
<el-radio-group v-model="purchase_product_offer.merge_product">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="purchase_product_offer.mark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogBuyer = false">取消</el-button>
<el-button type="primary" @click="goodsOfferUpdate"> 确认 </el-button>
</div>
</template>
</el-dialog>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiBeforehandOrderCartInfoLists,
apiBeforehandOrderCartInfoDelete,
apiBeforehandOrderCartInfoProcurementStatus,
apiBeforehandOrderCartInfoFix,
apiBeforehandOrderCartInfoSyncPrice,
apiBeforehandOrderCartInfoSetStoreSale
} from '@/api/beforehand_order_cart_info'
import { apiDeliveryServiceLists } from '@/api/delivery_service'
import feedback from '@/utils/feedback'
import { apiPurchaseProductOfferAdd } from '@/api/purchase_product_offer'
import EditPopup from './editProduct.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const ids = ref()
const dialogBuyer = ref(false)
//
const handleEdit = async (data: any, type: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
data.type = type
editRef.value?.setFormData(data)
}
//
const handleDeletes = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiBeforehandOrderCartInfoDelete({ id })
getLists()
}
const formData = ref({
id: '',
top_cate: []
})
const queryParams = reactive({
store_name: '',
bhoid: '',
pay_type: '',
top_cate: '',
top_cate_value: ''
})
const purchase_product_offer = ref({
order_id: '',
product_id: '',
need_num: '',
unit: '',
is_buyer: '',
buyer_id: '',
merge_product: 2,
mark: ''
})
const goodsOfferUpdate = () => {
apiPurchaseProductOfferAdd(purchase_product_offer.value).then((res) => {
getLists()
dialogBuyer.value = false
})
}
const delivery_list = ref([])
const DeliveryService = () => {
apiDeliveryServiceLists({ type: 3 }).then((res) => {
delivery_list.value = res.lists
})
}
/**
* 是否需采购
* @param e
*/
const handleBuyer = (e, row) => {
if (e == 1) {
purchase_product_offer.value.order_id = row.bhoid
purchase_product_offer.value.product_id = row.product_id
purchase_product_offer.value.unit = row.unit
purchase_product_offer.value.need_num = row.cart_num
purchase_product_offer.value.mark = row.mark
purchase_product_offer.value.is_buyer = '1'
DeliveryService()
dialogBuyer.value = true
} else {
apiBeforehandOrderCartInfoProcurementStatus({
id: row.id
}).then(() => {
getLists()
})
}
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBeforehandOrderCartInfoLists,
params: queryParams
})
const topCateChange = (row: any) => {
if (row.id == 0) {
queryParams.top_cate = ''
queryParams.top_cate_value = '全部'
getLists()
} else {
queryParams.top_cate = row.id
queryParams.top_cate_value = row.name
getLists()
}
}
const beforehand_order_cart_info = () => {
apiBeforehandOrderCartInfoLists({
export: 2,
bhoid: formData.value.id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
function getList(data: any) {
formData.value = data
queryParams.bhoid = data.id
getLists()
}
const fixAcceptNum = () => {
apiBeforehandOrderCartInfoFix({
bhoid: formData.value.id
}).then((res) => {
ElMessage.success('处理成功')
getLists()
})
}
const syncPrice = async() => {
await apiBeforehandOrderCartInfoSyncPrice({
bhoid: formData.value.id
})
getLists()
}
const setStoreSale = async(id) => {
await apiBeforehandOrderCartInfoSetStoreSale({
id: id
})
getLists()
}
onMounted(() => {
queryParams.bhoid = route.query.id
formData.value.id = route.query.id
getLists()
})
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,315 @@
<template>
<div>
<el-button
type="primary"
@click="OclickDialogBuyer"
v-perms="['beforehand_order.beforehand_order/createOutboundOrder']"
>
一键出库
</el-button>
<!-- <el-button type="primary" @click="xlsx(1)"> 打印采购单 </el-button> -->
<!-- <el-button type="primary" @click="xlsx(2)"> 打印供货单 </el-button>
<el-button type="primary" @click="xlsx(3)"> 打印商户/会员单 </el-button> -->
<!-- <el-button type="primary" @click="xlsx(4)"> 打印零售单 </el-button> -->
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="60" />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<!-- <el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" /> -->
<el-table-column label="出库数量" prop="nums" show-overflow-tooltip />
<el-table-column label="出库价" prop="price" show-overflow-tooltip />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
link
@click="returnWarehouseClick(row)"
v-perms="['beforehand_order.beforehand_order/returnWarehouseClick']"
>退库</el-button
>
<el-button
type="primary"
link
@click="resetWarehouseClick(row)"
v-perms="['warehouse_product.warehouse_product/resetNums']"
>重置数量</el-button
>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
</div>
</div>
<el-dialog v-model="dialogBuyer" title="出库设置" width="600">
<el-form ref="formRef" :model="one_click_storage" label-width="90px">
<el-form-item label="仓库">
<el-select
v-model="one_click_storage.warehouse_id"
placeholder="请选择仓库"
size="large"
style="width: 240px"
>
<el-option
v-for="item in warehouse_list"
:label="item.name"
:value="item.id"
:key="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="送货时间">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="one_click_storage.delivery_time"
clearable
type="date"
value-format="YYYY-MM-DD"
placeholder="选择生产日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="门店" prop="store_id">
<el-select
v-model="one_click_storage.store_id"
placeholder="请选择门店"
size="large"
style="width: 240px"
>
<el-option
v-for="item in store_list"
:label="item.name"
:value="item.id"
:key="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="one_click_storage.remark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogBuyer = false">取消</el-button>
<el-button type="primary" @click="oneClickStorage" :disabled="disableClick">
确认
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="returnWarehouseShow" title="退货设置" width="600">
<el-form :model="returnWarehouseData" label-width="90px">
<el-form-item label="商品名称" prop="store_name">
<el-input
v-model="returnWarehouseData.store_name"
clearable
:readonly="false"
disabled
/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="returnWarehouseData.nums"
clearable
:readonly="false"
placeholder="请输入数量"
/>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="returnWarehouseData.mark"
clearable
:readonly="false"
placeholder="请输入备注"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="returnWarehouseShow = false">取消</el-button>
<el-button type="primary" @click="returnWarehouseAdd"> 确认 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="resetWarehouseShow" title="重置数量" width="600">
<el-form :model="resetWarehouseData" label-width="90px">
<el-form-item label="商品名称" prop="store_name">
<el-input
v-model="resetWarehouseData.store_name"
clearable
:readonly="false"
disabled
/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="resetWarehouseData.nums"
clearable
:readonly="false"
placeholder="请输入数量"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="resetWarehouseShow = false">取消</el-button>
<el-button type="primary" @click="resetWarehouse"> 确认 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiBeforehandOrderOutboundLists,
apiBeforehandOrderCreateOutboundOrder
} from '@/api/beforehand_order'
import { apiWarehouseLists } from '@/api/warehouse'
import { apiSystemStoreLists } from '@/api/system_store'
import { apiWarehouseOrderExport } from '@/api/warehouse_order'
import { apiWarehouseProductReturnAdd } from '@/api/warehouse_product_return'
import { apiWarehouseProductSetNums } from '@/api/warehouse_product'
const dialogBuyer = ref(false)
const returnWarehouseShow = ref(false)
const resetWarehouseShow = ref(false)
const warehouse_list = ref([])
const store_list = ref([])
const order_id = ref({ id: 0 })
const outbound_id = ref(0)
const one_click_storage = ref({
bhoid: order_id.value.id,
warehouse_id: '',
remark: '',
delivery_time: '',
store_id: ''
})
const returnWarehouseData = ref({
id: '',
nums: '',
store_name: '',
financial_pm: 1,
return_type: 1,
bhoid: '',
mark: ''
})
const resetWarehouseData = ref({
id: '',
store_name: '',
nums: ''
})
const disableClick = ref(false)
const oneClickStorage = () => {
disableClick.value = true
// try {
apiBeforehandOrderCreateOutboundOrder(one_click_storage.value).then((res) => {
ElMessage.success('出库成功')
dialogBuyer.value = false
disableClick.value = false
getLists()
})
// } catch (error) {
// setTimeout(() => {
// disableClick.value = false
// }, 2000)
// }
setTimeout(() => {
disableClick.value = false
}, 4000)
}
const OclickDialogBuyer = () => {
dialogBuyer.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
apiSystemStoreLists({}).then((res) => {
store_list.value = res.lists
})
}
const xlsx = (type) => {
if (outbound_id.value > 0) {
apiWarehouseOrderExport({
id: outbound_id.value,
type: type
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
} else {
ElMessage.error('出库id不能为空')
}
}
const returnWarehouseClick = (data: any) => {
returnWarehouseShow.value = true
returnWarehouseData.value.id = data.id
returnWarehouseData.value.bhoid = order_id.value.id
returnWarehouseData.value.store_name = data.store_name
returnWarehouseData.value.nums = data.nums
}
const resetWarehouseClick = (data: any) => {
resetWarehouseShow.value = true
resetWarehouseData.value.id = data.id
resetWarehouseData.value.store_name = data.store_name
resetWarehouseData.value.nums = data.nums
}
//退
const returnWarehouseAdd = (data: any) => {
returnWarehouseShow.value = false
if (returnWarehouseData.value.bhoid <= 0) {
ElMessage.error('订单id不能为空')
return false
}
apiWarehouseProductReturnAdd(returnWarehouseData.value).then((res) => {})
}
//
const resetWarehouse = (data: any) => {
if (resetWarehouseData.value.id <= 0) {
ElMessage.error('id不能为空')
return false
}
apiWarehouseProductSetNums(resetWarehouseData.value).then((res) => {
resetWarehouseShow.value = false
getLists()
})
}
const queryParams = reactive({
id: order_id.value.id
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBeforehandOrderOutboundLists,
params: queryParams
})
function getList(id, order) {
outbound_id.value = order.outbound_id
order_id.value.id = id
one_click_storage.value.bhoid = id
queryParams.id = id
getLists()
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,56 @@
<template>
<div>
<el-button type="primary" @click="ReturnSupplier"> 导出退供应商单 </el-button>
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="60" />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="退供应商数量" prop="nums" show-overflow-tooltip />
<el-table-column label="退供应商价" prop="price" show-overflow-tooltip />
<el-table-column label="退供应商总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
</div>
</div>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import { apiWarehouseProductReturnLists } from '@/api/warehouse_product_return'
import { apiPurchaseOrderReturnSupplier } from '@/api/beforehand_order'
const queryParams = reactive({
bhoid: '',
return_type: 2
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseProductReturnLists,
params: queryParams
})
function getList(order) {
queryParams.bhoid = order.id
getLists()
}
const ReturnSupplier = () => {
apiPurchaseOrderReturnSupplier({ id: queryParams.bhoid }).then((res) => {
if (res.url != '') {
window.open(res.url, '_blank')
}
})
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,125 @@
<template>
<div>
<el-button type="primary" @click="StockReturn"> 导出退库单 </el-button>
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" width="60" />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="退库数量" prop="nums" show-overflow-tooltip />
<el-table-column label="退库价" prop="price" show-overflow-tooltip />
<el-table-column label="退库总价" prop="total_price" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<el-table-column label="操作" fixed="right">
<template #default="{ row }">
<el-button
type="primary"
link
@click="returnWarehouseClick(row)"
v-perms="['beforehand_order.beforehand_order/returnSupplierClick']"
>退供应商</el-button
>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
</div>
</div>
<el-dialog v-model="returnWarehouseShow" title="退货设置" width="600">
<el-form :model="returnWarehouseData" label-width="90px">
<el-form-item label="商品名称" prop="store_name">
<el-input
v-model="returnWarehouseData.store_name"
clearable
:readonly="false"
disabled
/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="returnWarehouseData.nums"
clearable
:readonly="false"
placeholder="请输入数量"
/>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="returnWarehouseData.mark"
clearable
:readonly="false"
placeholder="请输入备注"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="returnWarehouseShow = false">取消</el-button>
<el-button type="primary" @click="returnWarehouseAdd"> 确认 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiWarehouseProductReturnLists,
apiWarehouseProductReturnAdd
} from '@/api/warehouse_product_return'
import { apiPurchaseOrderStockReturn } from '@/api/beforehand_order'
const returnWarehouseShow = ref(false)
const returnWarehouseData = ref({
id: '',
nums: '',
store_name: '',
financial_pm: 0,
return_type: 2,
bhoid: '',
mark: ''
})
const queryParams = reactive({
bhoid: '',
return_type: 1
})
const returnWarehouseClick = (data: any) => {
returnWarehouseShow.value = true
returnWarehouseData.value.id = data.id
returnWarehouseData.value.bhoid = queryParams.bhoid
returnWarehouseData.value.store_name = data.store_name
returnWarehouseData.value.nums = data.nums
}
//退
const returnWarehouseAdd = (data: any) => {
returnWarehouseShow.value = false
apiWarehouseProductReturnAdd(returnWarehouseData.value).then((res) => {})
}
const StockReturn = () => {
apiPurchaseOrderStockReturn({ id: queryParams.bhoid }).then((res) => {
if (res.url != '') {
window.open(res.url, '_blank')
}
})
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiWarehouseProductReturnLists,
params: queryParams
})
function getList(order) {
queryParams.bhoid = order.id
getLists()
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,114 @@
<template>
<div>
<el-button type="primary" @click="xlsx()"> 打印入库单 </el-button>
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
<el-table-column prop="id" label="ID" />
<el-table-column label="供应商" prop="supplier_name" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" width="120">
<template #default="{ row }">
<el-image style="width: 50px; height: 50px" :src="row.image" :preview-teleported="true" />
</template>
</el-table-column>
<el-table-column label="商品名称" prop="store_name" show-overflow-tooltip />
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
<!-- <el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" /> -->
<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="操作" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="deleteFunc(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="flex mt-4 justify-end">
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
</div>
</div>
<el-dialog v-model="resetWarehouseShow" title="重置数量" width="600">
<el-form :model="resetWarehouseData" label-width="90px">
<el-form-item label="商品名称" prop="store_name">
<el-input v-model="resetWarehouseData.store_name" clearable :readonly="false" disabled />
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input v-model="resetWarehouseData.nums" clearable :readonly="false" placeholder="请输入数量" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="resetWarehouseShow = false">取消</el-button>
<el-button type="primary" @click="resetWarehouse"> 确认 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import { apiBeforehandOrderWarehousingLists } from '@/api/beforehand_order'
import { apiWarehouseOrderRentryExport } from '@/api/warehouse_order'
import { apiWarehouseProductSetNums, apiWarehouseProductDelete } from '@/api/warehouse_product'
const order_id = ref({ id: 0 })
const warehousing_id = ref(0)
const resetWarehouseShow = ref(false)
const queryParams = reactive({
id: order_id.value.id
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBeforehandOrderWarehousingLists,
params: queryParams
})
const xlsx = () => {
if (warehousing_id.value > 0) {
apiWarehouseOrderRentryExport({
id: warehousing_id.value
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
} else {
ElMessage.error('入库id不能为空')
}
}
const resetWarehouseData = ref({
id: '',
store_name: '',
nums: ''
})
const resetWarehouseClick = (data : any) => {
resetWarehouseShow.value = true
resetWarehouseData.value.id = data.id
resetWarehouseData.value.store_name = data.store_name
resetWarehouseData.value.nums = data.nums
}
const deleteFunc = (id) => {
apiWarehouseProductDelete({id}).then((res) => {
getLists()
})
}
//
const resetWarehouse = (data : any) => {
if (resetWarehouseData.value.id <= 0) {
ElMessage.error('id不能为空')
return false
}
apiWarehouseProductSetNums(resetWarehouseData.value).then((res) => {
resetWarehouseShow.value = false
getLists()
})
}
function getList(id, warehousing) {
order_id.value.id = id
queryParams.id = id
getLists()
warehousing_id.value = warehousing
}
defineExpose({
getList
})
</script>

View File

@ -0,0 +1,675 @@
<template>
<el-card>
<div class="flex items-center justify-between m-4">
<div class="flex flex-col">
<div style="color: gray">姓名</div>
<div style="color: black">{{ formData.other_data?.nickname }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">手机</div>
<div style="color: black">{{ formData.other_data?.phone }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">送货地址</div>
<div style="color: black">{{ formData.other_data?.address }}</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.order_id }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">支付单号</div>
<div style="color: black">{{ formData.order_sn }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">门店</div>
<div style="color: black">{{ formData.system_store }}</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.other_data?.arrival_time }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">桌数</div>
<div style="color: black">{{ formData.other_data?.tables }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">办事天数</div>
<div style="color: black">{{ formData.other_data?.days }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">厨师</div>
<div style="color: black">{{ formData.other_data?.chef }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">电话</div>
<div style="color: black">{{ formData.other_data?.chef_phone }}</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.other_data?.purpose }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">备注</div>
<div style="color: black">{{ formData.mark }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">代购备注</div>
<div style="color: black">{{ formData.other_data?.store_mark }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">分单员</div>
<div style="color: black">{{ formData.other_data?.splitting_officer }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">跟单员</div>
<div style="color: black">{{ formData.other_data?.merchandiser }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">仓管员</div>
<div style="color: black">{{ formData.other_data?.distribution_personnel }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">运输员</div>
<div style="color: black">{{ formData.other_data?.transporter }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">门店员</div>
<div style="color: black">{{ formData.other_data?.system_store_name }}</div>
</div>
<div class="flex flex-col">
<div style="color: gray">区域经理</div>
<div style="color: black">{{ formData.other_data?.regional_manager }}</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">
<div style="color: gray">支付金额</div>
<div style="color: black">{{ formData.pay_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, 1)"> 打印订单 </el-button> -->
<el-button @click="xlsx2(formData.id)"> 打印商品标签 </el-button>
<el-button @click="generateOrderClick"> 生成商品订单 </el-button>
<el-button @click="handleBuyer()" v-if="[6, 9].includes(formData.order_type)">
生成往期入库单
</el-button>
</div>
<div class="justify-between m-4">
<el-button v-if="formData.order_type != 7" @click="xlsx3(formData.id)">
打印下单清单
</el-button>
<el-button v-if="formData.order_type != 7" @click="xlsx4(formData.id)">
打印分配单
</el-button>
<el-button v-if="formData.order_type == 7" @click="xlsx5(formData.id)">
打印采购单
</el-button>
<el-button v-if="formData.order_type != 7" @click="xlsx6(formData.id)">
打印出库单
</el-button>
<el-button v-if="formData.order_type != 7" @click="xlsx6(formData.id, 2)">
打印供货单
</el-button>
<el-button v-if="formData.order_type != 7" @click="xlsx6(formData.id, 3)">
打印无价格出库单
</el-button>
</div>
<el-button type="primary" @click="dialogShop = true"> 追加 </el-button>
<el-button
type="primary"
@click="confirm(formData.id)"
v-if="formData.store_staff_id > 0 && formData.is_confirm == 0"
>
确认
</el-button>
<el-tabs
v-model="activeName"
class="demo-tabs mt-3"
type="border-card"
@tab-change="tabChange"
>
<el-tab-pane v-if="![7, 9].includes(formData.order_type)" label="明细" name="second">
<orderCartInfo ref="orderCartInfoRef" :id="formData.id" />
</el-tab-pane>
<el-tab-pane v-if="[7, 9].includes(formData.order_type)" label="采购" name="offer">
<goodsOffer ref="goodsOfferRef" :order_id="formData.id" />
</el-tab-pane>
<el-tab-pane
v-if="[7, 9].includes(formData.order_type)"
label="入库"
name="warehousing"
>
<warehousing ref="warehousingRef" :order_id="formData.id" />
</el-tab-pane>
<el-tab-pane v-if="![7, 9].includes(formData.order_type)" label="出库" name="outbound">
<outbound ref="outboundRef" :order_id="formData.id" />
</el-tab-pane>
<el-tab-pane
v-if="![7, 9].includes(formData.order_type)"
label="退库房"
name="returnWarehouse"
>
<returnWarehouse ref="returnWarehouseRef" />
</el-tab-pane>
<el-tab-pane
v-if="![7, 9].includes(formData.order_type)"
label="退供应商"
name="returnSupplier"
>
<returnSupplier ref="returnSupplierRef" />
</el-tab-pane>
</el-tabs>
</el-card>
<el-dialog v-model="dialogShop" title="追加商品" width="1200">
<el-form ref="formRef" label-width="90px">
<div class="mb-2">
<el-button type="primary" @click="showProduct = true">添加商品</el-button>
</div>
<el-table :data="productList">
<el-table-column label="商品ID" prop="id" show-overflow-tooltip />
<el-table-column label="商品图片" prop="image" min-width="80">
<template #default="{ row }">
<el-image
style="width: 50px; height: 50px"
:src="row.image"
:preview-teleported="true"
/>
</template>
</el-table-column>
<el-table-column
label="商品名称"
prop="store_name"
min-width="180"
show-overflow-tooltip
/>
<el-table-column
label="分类"
prop="cate_name"
min-width="80"
show-overflow-tooltip
/>
<el-table-column
label="单位"
prop="unit_name"
min-width="80"
show-overflow-tooltip
/>
<el-table-column label="数量" min-width="150">
<template #default="{ row }">
<el-input v-model="row.num" @change="handleChange(row)" />
</template>
</el-table-column>
<el-table-column label="价格" min-width="150">
<template #default="{ row }">
<el-input v-model="row.price" disabled />
</template>
</el-table-column>
<el-table-column label="总价" min-width="150">
<template #default="{ row }">
<el-input v-model="row.total_price" disabled />
</template>
</el-table-column>
<el-table-column label="生产日期" min-width="140">
<template #default="{ row }">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="row.manufacture"
clearable
type="date"
value-format="YYYY-MM-DD"
placeholder="选择生产日期"
>
</el-date-picker>
</template>
</el-table-column>
<el-table-column label="保质期" min-width="140">
<template #default="{ row }">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="row.expiration_date"
clearable
type="date"
value-format="YYYY-MM-DD"
placeholder="选择保质期"
>
</el-date-picker>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="danger" link @click="handleDeleteProdut(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogShop = false">取消</el-button>
<el-button type="primary" @click="appendAdd"> 确认 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="showProduct" title="选择商品" width="70%">
<!-- <product-pop
@onBindStore="onBindProduct"
:warehouse_id="warehouse_id"
:is_warehouse="1"
></product-pop> -->
<product-warehouse-pop
:key="productModalKey"
:userId="formData.uid"
:order_type="formData.order_type"
@onBindStore="onBindProduct"
></product-warehouse-pop>
</el-dialog>
<el-dialog v-model="generateOrderShow" title="生成支付订单设置" width="600">
<el-form :model="generateOrderData" label-width="90px">
<el-form-item label="用户">
<el-select
v-model="generateOrderData.user_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.real_name}|${item.mobile} (ID:${item.id})`"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="门店" prop="store_id">
<el-select
v-model="generateOrderData.store_id"
placeholder="请选择门店"
size="large"
style="width: 240px"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="支付方式" prop="pay_type">
<el-select
v-model="generateOrderData.pay_type"
placeholder="请选择支付方式"
size="large"
style="width: 240px"
>
<el-option label="微信小程序支付" value="7" />
<el-option label="采购款支付" value="18" />
<el-option label="余额支付" value="3" />
<el-option label="现金支付" value="17" />
</el-select>
</el-form-item>
<el-form-item label="优惠金额" prop="deduction_price">
<el-input
v-model="generateOrderData.deduction_price"
clearable
placeholder="请输入优惠金额"
:readonly="false"
/>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="generateOrderData.mark"
clearable
placeholder="请输入订单备注"
:readonly="false"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="generateOrderShow = false">取消</el-button>
<el-button type="primary" @click="generateOrderAdd"> 确认 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="dialogBuyer" title="设置采购" width="600">
<el-form ref="formRef" :model="purchase_product_offer" label-width="90px">
<el-form-item label="采购人员">
<el-select
v-model="purchase_product_offer.buyer_id"
placeholder="请选择采购人员"
size="large"
style="width: 240px"
>
<el-option
v-for="item in delivery_list"
:label="item.nickname"
:value="item.uid"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogBuyer = false">取消</el-button>
<el-button type="primary" @click="generatePastWarehouseReceiptd"> 确认 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup name="storeOrderDETAILS">
import { ElMessage, type FormInstance } from 'element-plus'
import {
apiBeforehandOrderCartInfoLists,
apiBeforehandOrderCartInfoAppendAdd
} from '@/api/beforehand_order_cart_info'
import {
apiPurchaseOrderExport,
apiPurchaseOrderGenerateOrder,
apiBeforehandOrderDetail,
apiPurchaseOrderExportOrderList,
apiPurchaseOrderOrderAllocation,
apiPurchaseOrderOrderInfo,
apiPurchaseOrderOrderOutbound,
apiBeforehandOrderConfirm
} from '@/api/beforehand_order'
import type { PropType, nextTick } from 'vue'
import { usePaging } from '@/hooks/usePaging'
import { useRoute } from 'vue-router'
import goodsOffer from './component/goodsOffer.vue'
import orderCartInfo from './component/orderCartInfo.vue'
import warehousing from './component/warehousing.vue'
import outbound from './component/outbound.vue'
import returnWarehouse from './component/returnWarehouse.vue'
import returnSupplier from './component/returnSupplier.vue'
import { apiUserLists } from '@/api/user'
import { apiSystemStoreLists } from '@/api/system_store'
import { hiprint } from 'vue-plugin-hiprint'
import { apiDeliveryServiceLists } from '@/api/delivery_service'
import { apiPurchaseProductOfferAddPurchasesOneClick } from '@/api/purchase_product_offer'
const generateOrderShow = ref(false)
const goodsOfferRef = ref(null)
const warehousingRef = ref(null)
const outboundRef = ref(null)
const orderCartInfoRef = ref(null)
const returnWarehouseRef = ref(null)
const returnSupplierRef = ref(null)
const route = useRoute()
const dialogBuyer = ref(false)
const tabChange = (type: any) => {
if (type == 'second') {
orderCartInfoRef.value?.getList(formData.value)
}
if (type == 'offer') {
goodsOfferRef.value?.getList(formData.value.id)
}
if (type == 'warehousing') {
warehousingRef.value?.getList(formData.value.id, formData.value.warehousing_id)
}
if (type == 'outbound') {
outboundRef.value?.getList(formData.value.id, formData.value)
}
if (type == 'returnWarehouse') {
returnWarehouseRef.value?.getList(formData.value)
}
if (type == 'returnSupplier') {
returnSupplierRef.value?.getList(formData.value)
}
}
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const showDialog = ref(false)
const dialogShop = ref(false)
const activeName = ref('second')
const warehouse_id = ref(0)
const is_warehouse = ref(0)
const financial_pm = ref(0)
//
const formData = ref({
id: '',
code: '',
total_price: '',
supplier_name: '',
warehouse_name: '',
system_store: '',
financial_pm: '',
order_sn: '',
warehousing_id: '',
top_cate: [],
uid: '',
store_id: '',
order_type: '',
store_staff_id: '',
is_confirm: 0
})
const generateOrderData = ref({
id: '',
user_id: '',
order_type: '',
pay_type: '',
store_id: '',
deduction_price: '0.00',
mark: ''
})
const appendAdd = () => {
const product_arr = productList.value.map((item: any) => {
return {
id: item.id,
nums: item.num || 0,
unit: item.unit || 0,
purchase: item.price || 0,
prices: item.purchase || 0,
total_price: item.total_price || 0,
manufacture: item.manufacture,
expiration_date: item.expiration_date
}
})
apiBeforehandOrderCartInfoAppendAdd({
id: queryParams.bhoid,
product_arr: product_arr
}).then((res) => {
dialogShop.value = false
})
if (formData.value.order_type == 7) {
goodsOfferRef.value?.getList(formData.value.id)
}
}
const queryParams = reactive({
bhoid: route.query.id,
pay_type: '',
top_cate: '',
top_cate_value: ''
})
const getDetail = () => {
apiBeforehandOrderDetail({ id: queryParams.bhoid }).then((row: any) => {
formData.value = { ...row }
warehouse_id.value = row.warehouse_id
generateOrderData.value.id = row.id
generateOrderData.value.store_id = row.store_id
generateOrderData.value.user_id = row.uid
generateOrderData.value.order_type = row.order_type
if (row.financial_pm == 0) {
is_warehouse.value = 1
} else {
financial_pm.value = 1
}
productList.value = []
if ([7, 9].includes(formData.value.order_type)) {
activeName.value = 'offer'
nextTick(() => {
goodsOfferRef.value.getList(formData.value.id)
})
}
})
}
getDetail()
const xlsx2 = (id) => {
apiPurchaseOrderExport({
id: id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
const xlsx3 = (id) => {
apiPurchaseOrderExportOrderList({
id: id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
const xlsx4 = (id) => {
apiPurchaseOrderOrderAllocation({
id: id
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
const xlsx5 = (id) => {
apiPurchaseOrderOrderInfo({
id: id,
print: 1
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
const xlsx6 = (id, type = 1) => {
apiPurchaseOrderOrderOutbound({
id: id,
type: type
}).then((res) => {
window.open(res.url, '_blank')
ElMessage.success('导出成功')
})
}
const showProduct = ref(false) //
//
const productList = ref([])
//
const handleDeleteProdut = (id: number) => {
productList.value = productList.value.filter((item: any) => item.id !== id)
}
//
const onBindProduct = (e: any[]) => {
e.forEach((item: any) => {
if (!productList.value.find((t: any) => t.id == item.id)) {
productList.value.push(item)
}
})
showProduct.value = false
}
function handleChange(row) {
row.total_price = row.num * row.price
}
//
const open = () => {
showDialog.value = true
}
const userloading = ref(false)
const userList = ref([])
const remoteMethodUser = (e = '') => {
userloading.value = true
apiUserLists({
nickname: e,
page_size: 10
})
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
const storeList = ref([])
const generateOrderClick = () => {
generateOrderShow.value = true
apiSystemStoreLists({ page_no: 1, page_size: 100 }).then((res) => {
storeList.value = res.lists
})
}
const purchase_product_offer = ref({
order_id: '',
buyer_id: ''
})
const generatePastWarehouseReceiptd = () => {
apiPurchaseProductOfferAddPurchasesOneClick(purchase_product_offer.value).then((res) => {})
}
const generateOrderAdd = () => {
apiPurchaseOrderGenerateOrder(generateOrderData.value).then((res) => {
generateOrderShow.value = false
})
}
const confirm = (id) => {
apiBeforehandOrderConfirm({ id }).then((res) => {
formData.value.is_confirm = 1
})
}
const delivery_list = ref([])
const DeliveryService = () => {
apiDeliveryServiceLists({ type: 3 }).then((res) => {
delivery_list.value = res.lists
})
}
/**
* 是否需采购
* @param e
*/
const handleBuyer = () => {
purchase_product_offer.value.order_id = formData.value.id
DeliveryService()
dialogBuyer.value = true
}
const productModalKey = ref(0)
const resetUserId = (e) => {
productModalKey.value++
}
defineExpose({
open
})
</script>

View File

@ -0,0 +1,264 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="1000px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-row>
<el-col :span="6">
<el-form-item label="用户" prop="nickname">
<el-input v-model="formData.other_data.nickname" type="input" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="电话" prop="phone">
<el-input v-model="formData.other_data.phone" type="input" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地址" prop="address">
<el-input
v-model="formData.other_data.address"
type="input"
style="width: 400px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="门店" prop="store_id" style="width: 200px">
<el-select
v-model="formData.store_id"
placeholder="请选择门店"
size="large"
>
<el-option
v-for="item in storeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="到货时间" prop="arrival_time">
<el-date-picker
v-model="formData.other_data.arrival_time"
type="datetime"
:readonly="false"
clearable
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择到货时间"
style="width: 180px"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="桌数" prop="tables">
<el-input-number v-model="formData.other_data.tables" type="input" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="办事天数" prop="days">
<el-input-number v-model="formData.other_data.days" type="input" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="厨师" prop="chef">
<el-input v-model="formData.other_data.chef" type="input" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="电话" prop="chef_phone">
<el-input v-model="formData.other_data.chef_phone" type="input" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="备注" prop="purpose">
<el-input
v-model="formData.other_data.purpose"
type="input"
style="width: 480px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="内部备注" prop="mark">
<el-input v-model="formData.mark" type="input" style="width: 480px" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="代购备注" prop="store_mark">
<el-input
v-model="formData.other_data.store_mark"
type="textarea"
:arows="3"
style="width: 80%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="分单员" prop="splitting_officer">
<el-input
v-model="formData.other_data.splitting_officer"
type="input"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="跟单员" prop="merchandiser">
<el-input v-model="formData.other_data.merchandiser" type="input" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="仓管员" prop="distribution_personnel">
<el-input
v-model="formData.other_data.distribution_personnel"
type="input"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="运输员" prop="transporter">
<el-input v-model="formData.other_data.transporter" type="input" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="门店员" prop="system_store_name">
<el-input
v-model="formData.other_data.system_store_name"
type="input"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="区域经理" prop="regional_manager">
<el-input v-model="formData.other_data.regional_manager" type="input" />
</el-form-item>
</el-col>
</el-row>
<!-- <el-form-item label="图片" prop="file">
<material-picker v-model="formData.file" :limit="1" />
</el-form-item> -->
<el-form-item
label="订单类型"
prop="order_type"
v-perms="['beforehand_order.beforehand_order/order_type']"
>
<el-radio-group v-model="formData.order_type" @change="handleOrderType()">
<el-radio :label="1">铺货订单</el-radio>
<el-radio :label="2">摊贩订单</el-radio>
<el-radio :label="3">一条龙订单</el-radio>
<!-- <el-radio :label="4">线上订单</el-radio> -->
<el-radio :label="5">仓库补货</el-radio>
<el-radio :label="6">往期补单-出库</el-radio>
<el-radio :label="9">往期补单-入库</el-radio>
<el-radio :label="8">其他订单</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="formData.mark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="beforehandOrderEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiBeforehandOrderAdd,
apiBeforehandOrderEdit,
apiBeforehandOrderDetail
} from '@/api/beforehand_order'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
import { apiSystemStoreLists } from '@/api/system_store'
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 storeList = ref([])
apiSystemStoreLists({ page_no: 1, page_size: 100 }).then((res) => {
storeList.value = res.lists
})
//
const formData = reactive({
id: '',
file: '',
other_data: {},
store_id: '',
order_type: '',
mark: ''
})
//
const setFormData = async (data: Record<any, any>) => {
const datas = await apiBeforehandOrderDetail({
id: data.id
})
for (const key in formData) {
if (datas[key] != null && datas[key] != undefined) {
//@ts-ignore
formData[key] = datas[key]
}
}
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData }
mode.value == 'edit' ? await apiBeforehandOrderEdit(data) : await apiBeforehandOrderAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData
})
</script>

View File

@ -0,0 +1,268 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="ID" prop="id">
<el-input
class="w-[280px]"
v-model="queryParams.id"
clearable
placeholder="请输入id"
/>
</el-form-item>
<el-form-item label="单号" prop="code">
<el-input
class="w-[280px]"
v-model="queryParams.code"
clearable
placeholder="请输入单号"
@change="resetPage"
/>
</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="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>
<export-data
class="ml-2.5"
:fetch-fun="apiWarehouseOrderLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<router-link
v-perms="['warehousing']"
: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 label="id" prop="id" show-overflow-tooltip width="70" />
<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="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="total_price" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" 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/edit']"
type="primary"
link
@click="handleEdit(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/psi/psi_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 = ref()
const detailsRef = ref()
//
const showEdit = ref(false)
const showDetails = ref(false)
//
const queryParams = reactive({
id: '',
warehouse_id: '',
product_name: '',
financial_pm: 1,
store_id: '',
start_time: '',
end_time: '',
code: '',
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({ mer_name: e })
.then((res) => {
userList.value = res.lists
setTimeout(() => {
userloading.value = false
}, 300)
})
.catch((err) => {
setTimeout(() => {
userloading.value = false
}, 300)
})
}
onMounted(() => {
getLists()
})
</script>