开发新增预订单功能及相关接口

- 新增预订单购物车详情相关接口
- 新增采购信息设置和一键入库功能
- 修改预订单列表和详情页面,增加采购和出入库相关功能
- 优化预订单商品表格,增加是否需采购列
- 新增采购人员选择功能
This commit is contained in:
mkm 2024-10-05 16:21:26 +08:00
parent 6af668c2b7
commit 3812ab5074
9 changed files with 632 additions and 35 deletions

View File

@ -6,6 +6,6 @@ VITE_NOW_TYPE = 'dist'
# VITE_APP_BASE_URL='http://192.168.1.10:8546'
# VITE_APP_BASE_URL='https://test-multi-store.lihaink.cn'
# VITE_APP_BASE_URL='https://multi-store.lihaink.cn'
VITE_APP_BASE_URL='http://192.168.1.22:8545'
VITE_APP_BASE_URL='http://192.168.1.7:8545'
# VITE_APP_BASE_URL='https://ceshi-multi-store.lihaink.cn'

View File

@ -14,6 +14,10 @@ export function apiBeforehandOrderAdd(params: any) {
export function apiBeforehandOrderEdit(params: any) {
return request.post({ url: '/beforehand_order/beforehandorder/edit', params })
}
// 一键入库
export function apiBeforehandOrderCreateOutboundOrder(params: any) {
return request.post({ url: '/beforehand_order/beforehandorder/createOutboundOrder', params })
}
// 删除预订单表
export function apiBeforehandOrderDelete(params: any) {
@ -24,3 +28,12 @@ export function apiBeforehandOrderDelete(params: any) {
export function apiBeforehandOrderDetail(params: any) {
return request.get({ url: '/beforehand_order/beforehandorder/detail', params })
}
// 入库列表
export function apiBeforehandOrderWarehousingLists(params: any) {
return request.get({ url: '/beforehand_order/beforehandorder/warehousing_lists', params })
}
// 出库列表
export function apiBeforehandOrderOutboundLists(params: any) {
return request.get({ url: '/beforehand_order/beforehandorder/outbound_lists', params })
}

View File

@ -28,6 +28,20 @@ export function apiBeforehandOrderCartInfoDelete(params: any) {
params
})
}
// 编辑预订单购物详情无需采购
export function apiBeforehandOrderCartInfoProcurementStatus(params: any) {
return request.post({
url: '/beforehand_order_cart_info/beforehandordercartinfo/procurement_status',
params
})
}
// 一键入库
export function apiBeforehandOrderCartInfoOneClickStorage(params: any) {
return request.post({
url: '/beforehand_order_cart_info/beforehandordercartinfo/one_click_storage',
params
})
}
// 预订单购物详情表详情
export function apiBeforehandOrderCartInfoDetail(params: any) {

View File

@ -19,6 +19,13 @@ export function apiPurchaseProductOfferEdit(params: any) {
export function apiPurchaseProductOfferDelete(params: any) {
return request.post({ url: '/purchase_product_offer/purchaseproductoffer/delete', params })
}
// 设置采购信息
export function apiPurchaseProductOfferSetProcureInfo(params: any) {
return request.post({
url: '/purchase_product_offer/purchaseproductoffer/setProcureInfo',
params
})
}
// 采购供应链商品详情
export function apiPurchaseProductOfferDetail(params: any) {

View File

@ -1,6 +1,6 @@
<template>
<el-card>
<div class="mb-4 text-lg font-bold">商品入库操作</div>
<div class="mb-4 text-lg font-bold">预定单添加</div>
<div>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="总价" prop="total_price">

View File

@ -0,0 +1,252 @@
<template>
<div>
<el-button type="primary" @click="OclickDialogBuyer"> 一键入库 </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 width="120" />
<el-table-column label="单位" prop="unit_name" width="80" show-overflow-tooltip />
<el-table-column
label="供应商"
prop="supplier_name"
show-overflow-tooltip
width="100"
/>
<el-table-column label="需求数量" prop="need_num" show-overflow-tooltip width="100" />
<el-table-column label="采购数量" prop="buyer_nums" show-overflow-tooltip width="100" />
<el-table-column label="采购价" prop="price" show-overflow-tooltip width="100" />
<el-table-column
label="采购总价"
prop="total_price"
show-overflow-tooltip
width="100"
/>
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" />
<el-table-column
label="采购状态"
prop="buyer_confirm_name"
show-overflow-tooltip
width="100"
/>
<el-table-column
label="是否入库"
prop="is_storage_name"
show-overflow-tooltip
width="100"
/>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button type="primary" link @click="procureClick(row)"
>设置采购信息</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="completed_amount">
<el-input
v-model="one_click_storage.completed_amount"
clearable
placeholder="请输入已结金额"
:readonly="false"
/>
</el-form-item>
<el-form-item label="未结金额" prop="outstanding_amount">
<el-input
v-model="one_click_storage.outstanding_amount"
clearable
placeholder="请输入未结金额"
:readonly="false"
/>
</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"> 确认 </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
remote
reserve-keyword
placeholder="输入供应商名称搜索"
remote-show-suffix
:remote-method="remoteMethodSupplier"
:loading="supplierLoading"
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"
/>
</el-form-item>
<el-form-item label="单价" prop="price">
<el-input
v-model="formData.price"
clearable
placeholder="请输入已结金额"
:readonly="false"
/>
</el-form-item>
<el-form-item label="采购总价" prop="total_price">
<el-input
v-model="formData.total_price"
clearable
placeholder="请输入采购总价"
:readonly="false"
/>
</el-form-item>
</el-form>
<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>
</template>
<script lang="ts" setup name="subOrder">
import { usePaging } from '@/hooks/usePaging'
import {
apiPurchaseProductOfferLists,
apiPurchaseProductOfferSetProcureInfo
} from '@/api/purchase_product_offer'
import { apiBeforehandOrderCartInfoOneClickStorage } from '@/api/beforehand_order_cart_info'
import { apiWarehouseLists } from '@/api/warehouse'
import { apiSupplierLists } from '@/api/supplier'
import { useRoute } from 'vue-router'
const props = defineProps(['order_id'])
const dialogBuyer = ref(false)
const procureShow = ref(false)
const warehouse_list = ref([])
const one_click_storage = ref({
bhoid: props.order_id,
warehouse_id: '',
remark: '',
completed_amount: '',
outstanding_amount: ''
})
const formData = ref({
id: '',
supplier_id: '',
price: '',
total_price: '',
buyer_nums: ''
})
const oneClickStorage = () => {
apiBeforehandOrderCartInfoOneClickStorage(one_click_storage.value).then((res) => {
dialogBuyer.value = false
getLists()
})
}
/**
* 采购信息设置
*/
const setProcureInfo = () => {
apiPurchaseProductOfferSetProcureInfo(formData.value).then((res) => {
procureShow.value = false
getLists()
})
}
const procureClick = (data: any) => {
formData.value.id = data.id
procureShow.value = true
}
const OclickDialogBuyer = () => {
dialogBuyer.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
}
const queryParams = reactive({
order_id: props.order_id,
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
})
defineExpose({
getLists
})
</script>

View File

@ -0,0 +1,143 @@
<template>
<div>
<el-button type="primary" @click="OclickDialogBuyer"> 一键出库 </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="supplier_name"
show-overflow-tooltip
width="100"
/>
<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 width="120" />
<el-table-column label="单位" prop="unit_name" width="80" show-overflow-tooltip />
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" />
<el-table-column label="入库数量" prop="nums" show-overflow-tooltip width="100" />
<el-table-column label="采购价" prop="purchase" show-overflow-tooltip width="100" />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip width="100" />
</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"> 确认 </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'
const dialogBuyer = ref(false)
const warehouse_list = ref([])
const store_list = ref([])
const props = defineProps(['order_id'])
const one_click_storage = ref({
bhoid: props.order_id,
warehouse_id: '',
remark: '',
delivery_time: '',
store_id: ''
})
const oneClickStorage = () => {
apiBeforehandOrderCreateOutboundOrder(one_click_storage.value).then((res) => {
dialogBuyer.value = false
getLists()
})
}
const OclickDialogBuyer = () => {
dialogBuyer.value = true
apiWarehouseLists({}).then((res) => {
warehouse_list.value = res.lists
})
apiSystemStoreLists({}).then((res) => {
store_list.value = res.lists
})
}
const queryParams = reactive({
id: props.order_id
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBeforehandOrderOutboundLists,
params: queryParams
})
defineExpose({
getLists
})
</script>

View File

@ -0,0 +1,51 @@
<template>
<div>
<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="supplier_name"
show-overflow-tooltip
width="100"
/>
<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 width="120" />
<el-table-column label="单位" prop="unit_name" width="80" show-overflow-tooltip />
<el-table-column label="采购人员" prop="buyer_name" show-overflow-tooltip width="100" />
<el-table-column label="入库数量" prop="nums" show-overflow-tooltip width="100" />
<el-table-column label="采购价" prop="purchase" show-overflow-tooltip width="100" />
<el-table-column label="总价" prop="total_price" show-overflow-tooltip width="100" />
</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 { apiBeforehandOrderWarehousingLists } from '@/api/beforehand_order'
const props = defineProps(['order_id'])
const queryParams = reactive({
id: props.order_id
})
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiBeforehandOrderWarehousingLists,
params: queryParams
})
defineExpose({
getLists
})
</script>

View File

@ -19,7 +19,12 @@
</div>
<el-button type="primary" @click="dialogShop = true"> 追加 </el-button>
<el-tabs v-model="activeName" class="demo-tabs mt-3" type="border-card">
<el-tabs
v-model="activeName"
class="demo-tabs mt-3"
type="border-card"
@tab-change="tabChange"
>
<el-tab-pane label="明细" name="second">
<div>
<div>
@ -40,13 +45,50 @@
</div>
</template>
</el-table-column>
<el-table-column label="数量" prop="cart_num" 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="price" show-overflow-tooltip />
<el-table-column
label="合计"
prop="total_price"
show-overflow-tooltip
/>
<el-table-column
label="是否需采购"
prop="is_buyer"
show-overflow-tooltip
width="100"
>
<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>{{ row.is_buyer_name }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
@ -74,9 +116,15 @@
</div>
</div>
</el-tab-pane>
<el-tab-pane label="采购" name="procure"></el-tab-pane>
<el-tab-pane label="入库" name="warehousing"></el-tab-pane>
<el-tab-pane label="出库" name="outbound"></el-tab-pane>
<el-tab-pane label="采购" name="offer">
<goodsOffer ref="goodsOfferRef" :order_id="formData.id" />
</el-tab-pane>
<el-tab-pane label="入库" name="warehousing">
<warehousing ref="warehousingRef" :order_id="formData.id" />
</el-tab-pane>
<el-tab-pane label="出库" name="outbound">
<outbound ref="outboundRef" :order_id="formData.id" />
</el-tab-pane>
</el-tabs>
</el-drawer>
<el-dialog v-model="dialogShop" title="追加商品" width="1200">
@ -168,7 +216,7 @@
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogShop = false">取消</el-button>
<el-button type="primary" @click="goodsOfferUpdate"> 确认 </el-button>
<el-button type="primary" @click="appendAdd"> 确认 </el-button>
</div>
</template>
</el-dialog>
@ -180,15 +228,52 @@
></product-pop>
</el-dialog>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
<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-item label="采购数量" prop="need_num">
<el-input
v-model="purchase_product_offer.need_num"
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>
</template>
<script lang="ts" setup name="storeOrderDETAILS">
import { ElMessage, type FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiPurchaseProductOfferLists,
apiPurchaseProductOfferAdd
} from '@/api/purchase_product_offer'
import {
apiBeforehandOrderCartInfoLists,
apiBeforehandOrderCartInfoDelete,
apiBeforehandOrderCartInfoAppendAdd
apiBeforehandOrderCartInfoAppendAdd,
apiBeforehandOrderCartInfoProcurementStatus
} from '@/api/beforehand_order_cart_info'
import { apiWarehouseOrderRentryExport, apiWarehouseOrderExport } from '@/api/warehouse_order'
import type { PropType } from 'vue'
@ -196,13 +281,32 @@ import { usePaging } from '@/hooks/usePaging'
import { useRoute } from 'vue-router'
import feedback from '@/utils/feedback'
import EditPopup from './editProduct.vue'
import { apiDeliveryServiceLists } from '@/api/delivery_service'
import goodsOffer from './component/goodsOffer.vue'
import warehousing from './component/warehousing.vue'
import outbound from './component/outbound.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const dialogBuyer = ref(false)
const goodsOfferRef = ref(null)
const warehousingRef = ref(null)
const outboundRef = ref(null)
const route = useRoute()
const tabChange = (type: any) => {
if (type == 'offer') {
goodsOfferRef.value?.getLists()
}
if (type == 'warehousing') {
warehousingRef.value?.getLists()
}
if (type == 'outbound') {
outboundRef.value?.getLists()
}
}
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
@ -227,8 +331,21 @@ const formData = ref({
system_store: '',
financial_pm: ''
})
const updateInfo = ref({})
const purchase_product_offer = ref({
order_id: '',
product_id: '',
need_num: '',
unit: '',
is_buyer: '',
buyer_id: ''
})
const goodsOfferUpdate = () => {
apiPurchaseProductOfferAdd(purchase_product_offer.value).then((res) => {
getLists()
dialogBuyer.value = false
})
}
const appendAdd = () => {
const product_arr = productList.value.map((item: any) => {
return {
id: item.id,
@ -308,32 +425,32 @@ const onBindProduct = (e: any[]) => {
function handleChange(row) {
row.total_price = row.num * row.purchases
}
const isSubmit = ref(true)
const handleStock = () => {
// const counts = storeList.value.length
const product_arr = productList.value.map((item: any) => {
return {
id: item.product_id,
stock: item.new_stock || 0,
stocks: item.stock || 0
}
const delivery_list = ref([])
const DeliveryService = () => {
apiDeliveryServiceLists({ type: 3 }).then((res) => {
delivery_list.value = res.lists
})
if (product_arr.length > 0) {
try {
product_arr.forEach((item) => {
const stock = item.stock * 1
if (stock > item.stocks) {
isSubmit.value = false
throw new Error('超出仓库库存,请重新设置')
}
})
} catch (e) {
ElMessage.error('超出仓库库存,请重新设置')
return
}
}
/**
* 是否需采购
* @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.need_num
purchase_product_offer.value.is_buyer = '1'
DeliveryService()
dialogBuyer.value = true
} else {
apiBeforehandOrderCartInfoProcurementStatus({
id: row.id
}).then(() => {
getLists()
})
}
isSubmit.value = true
}
//
const handleEdit = async (data: any) => {