上传
This commit is contained in:
@@ -1,8 +1,67 @@
|
||||
<template>
|
||||
<el-dialog title="发货" v-model="show" width="600px">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||
<el-form-item label="发货仓库" prop="warehouseId">
|
||||
<el-select v-model="form.warehouseId" placeholder="选择仓库" filterable>
|
||||
<el-dialog title="发货" v-model="show" width="700px">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="85px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" :offset="0">
|
||||
<el-form-item label="待发数量">
|
||||
<span class="font-bold">:{{ form.sendTotalNum }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16" :offset="0" v-if="autoAuditPurchase == 'true'">
|
||||
<el-form-item label="发货方式">
|
||||
<el-radio-group v-model="form.sendType">
|
||||
<el-radio :label="1"> 立即采购发货 </el-radio>
|
||||
<el-radio :label="2"> 使用库存发货 </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<template v-if="form.sendType == 1">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="供应商" prop="supplier">
|
||||
<el-select v-model="form.supplier" placeholder="选择供应商" filterable>
|
||||
<el-option
|
||||
v-for="item in supplierOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="采购数量" prop="purchaseNum">
|
||||
<el-input-number
|
||||
:min="form.sendTotalNum"
|
||||
v-model="form.purchaseNum"
|
||||
:controls="false"
|
||||
placeholder="请输入"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="采购单价" prop="unitPrice">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
:controls="false"
|
||||
v-model="form.unitPrice"
|
||||
placeholder="请输入"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="存放仓库" prop="warehouseId">
|
||||
<el-select
|
||||
v-model="form.warehouseId"
|
||||
placeholder="请选择"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in warehouseOptions"
|
||||
:key="item.warehouseId"
|
||||
@@ -11,6 +70,23 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-table :data="inventoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="id" label="入库批次号" width="150px" />
|
||||
<el-table-column prop="warehouseName" label="存放仓库" width="120px" />
|
||||
<el-table-column prop="unitPrice" label="采购价" width="90px" />
|
||||
<el-table-column prop="remainNum" label="剩余库存" width="90px" />
|
||||
<el-table-column label="发货数量">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.sendNum" size="small" :min="1" :controls="false" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
<el-form-item label="备注">
|
||||
<Editor v-model:modelValue="form.remark" />
|
||||
</el-form-item>
|
||||
@@ -27,10 +103,13 @@
|
||||
<script setup name="DialogDelivery">
|
||||
import { getSimpleWarehouseList } from '@/api/mall/warehouse'
|
||||
import { createDelivery } from '@/api/clue/delivery'
|
||||
import { getConfigList } from '@/api/system/set'
|
||||
import { getDictOptions } from '@/utils/dict'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const warehouseOptions = ref([])
|
||||
const supplierOptions = getDictOptions('erp_supplier')
|
||||
function getOptions() {
|
||||
getSimpleWarehouseList().then((data) => {
|
||||
warehouseOptions.value = data
|
||||
@@ -38,9 +117,9 @@ function getOptions() {
|
||||
}
|
||||
|
||||
const show = ref(false)
|
||||
function open(id) {
|
||||
function open(id, signNum) {
|
||||
show.value = true
|
||||
resetForm(id)
|
||||
resetForm(id, signNum)
|
||||
}
|
||||
defineExpose({
|
||||
open
|
||||
@@ -48,12 +127,21 @@ defineExpose({
|
||||
|
||||
const form = ref({})
|
||||
const rules = ref({
|
||||
supplier: { required: true, message: '供应商不可为空', trigger: 'change' },
|
||||
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' },
|
||||
purchaseNum: { required: true, message: '采购数量不可为空', trigger: 'change,blur' },
|
||||
unitPrice: { required: true, message: '采购单价不可为空', trigger: 'change,blur' },
|
||||
warehouseId: { required: true, message: '仓库不可为空', trigger: 'change' }
|
||||
})
|
||||
function resetForm(id) {
|
||||
function resetForm(id, num) {
|
||||
form.value = {
|
||||
sendType: 2,
|
||||
sendTotalNum: num,
|
||||
signProductId: id,
|
||||
warehouseId: undefined,
|
||||
supplier: undefined,
|
||||
purchaseNum: num,
|
||||
unitPrice: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
}
|
||||
@@ -64,8 +152,26 @@ const formRef = ref()
|
||||
async function onSubmit() {
|
||||
// 校验表单
|
||||
if (!formRef.value) return
|
||||
|
||||
if (form.value.sendType == 1) {
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
} else {
|
||||
if (!deliveryArr.value.length) {
|
||||
message.info('请选择库存发货!')
|
||||
return
|
||||
} else {
|
||||
const deliveryCount = deliveryArr.value.reduce((pre, cur) => pre + cur.sendNum, 0)
|
||||
if (deliveryCount < form.value.sendTotalNum) {
|
||||
message.info('所选发货库存少于待发货数量,请重新选择后再发货!')
|
||||
return
|
||||
} else if (deliveryCount > form.value.sendTotalNum) {
|
||||
message.info('所选发货库存多于待发货数量,请重新选择后再发货!')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
@@ -78,8 +184,26 @@ async function onSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
const inventoryList = ref([
|
||||
{ id: 123, warehouseName: '自营仓', unitPrice: 120, remainNum: 5 },
|
||||
{ id: 234, warehouseName: '自营仓', unitPrice: 100, remainNum: 5 },
|
||||
{ id: 345, warehouseName: '供应商仓', unitPrice: 110, remainNum: 999 }
|
||||
])
|
||||
|
||||
const deliveryArr = ref([])
|
||||
function handleSelectionChange(val) {
|
||||
deliveryArr.value = val
|
||||
}
|
||||
|
||||
const autoAuditPurchase = ref('false')
|
||||
onMounted(() => {
|
||||
getOptions()
|
||||
getConfigList({ module: 3 }).then((data) => {
|
||||
// 获取所有配置项
|
||||
autoAuditPurchase.value = data.find(
|
||||
(it) => it.configKey == 'purchaseAuditAutoCompleteConfig'
|
||||
).configValue
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
<el-tab-pane label="成交信息" name="orderInfo">
|
||||
<Descriptions :data="orderInfo" :schema="orderSchema" :columns="2" labelWidth="130px" />
|
||||
<template v-if="orderInfo.signProducts && orderInfo.signProducts.length">
|
||||
<el-divider direction="horizontal" content-position="left">成交产品</el-divider>
|
||||
<el-divider direction="horizontal" content-position="left">
|
||||
成交产品<span v-if="prodTotalPrice">,应收:{{ prodTotalPrice }}</span>
|
||||
</el-divider>
|
||||
<el-table :data="orderInfo.signProducts" border stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column prop="productName" label="成交产品" />
|
||||
<el-table-column prop="specsName" label="产品规格" />
|
||||
<el-table-column prop="signNum" label="成交数量" />
|
||||
<el-table-column prop="warehouseName" label="发货仓库" />
|
||||
<el-table-column prop="signNum" label="成交数量" width="100px" />
|
||||
<el-table-column prop="warehouseName" label="发货仓库" width="150px" />
|
||||
<el-table-column label="发货状态" width="100px">
|
||||
<template #default="scope">
|
||||
{{ scope.row.warehouseName ? '已发货' : '待发货' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发货备注">
|
||||
<template #default="scope">
|
||||
<el-popover
|
||||
@@ -31,15 +38,26 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
<el-divider direction="horizontal" content-position="left">其他费用</el-divider>
|
||||
<el-divider direction="horizontal" content-position="left">
|
||||
其他费用<span v-if="extraTotalPrice">,应收:{{ extraTotalPrice }}</span>
|
||||
</el-divider>
|
||||
<el-table :data="orderInfo.extraPay" border stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column prop="extraPayType" label="费用项" />
|
||||
<el-table-column prop="extraPayMoney" label="金额" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
<el-divider
|
||||
v-if="prodTotalPrice + extraTotalPrice"
|
||||
direction="horizontal"
|
||||
content-position="left"
|
||||
>
|
||||
合计应收:{{ prodTotalPrice + extraTotalPrice }}
|
||||
</el-divider>
|
||||
<div v-if="checkPermi(['clue:order:add-fee'])">
|
||||
<el-divider direction="horizontal" content-position="left">额外支出</el-divider>
|
||||
<el-divider direction="horizontal" content-position="left">
|
||||
额外支出<span v-if="extraPayTotalFee">,合计:{{ extraPayTotalFee }}</span>
|
||||
</el-divider>
|
||||
<el-table :data="extraPayList" border stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column prop="extraPayType" label="支出项" />
|
||||
@@ -86,11 +104,31 @@ import { formatDate } from '@/utils/formatTime'
|
||||
const tabName = ref('clueInfo')
|
||||
const show = ref(false)
|
||||
const clueInfo = ref({})
|
||||
const orderInfo = ref({})
|
||||
const orderInfo = ref({
|
||||
signProducts: [],
|
||||
extraPay: []
|
||||
})
|
||||
const returnRecordList = ref([])
|
||||
const aftersaleList = ref([])
|
||||
const extraPayList = ref([])
|
||||
|
||||
const prodTotalPrice = computed(() => {
|
||||
return orderInfo.value.signProducts.reduce(
|
||||
(pre, cur) => pre + (cur?.price || 0) * (cur?.signNum || 0),
|
||||
0
|
||||
)
|
||||
})
|
||||
|
||||
// 其他费用
|
||||
const extraTotalPrice = computed(() => {
|
||||
return orderInfo.value.extraPay.reduce((pre, cur) => pre + cur.extraPayMoney, 0)
|
||||
})
|
||||
|
||||
// 额外支出
|
||||
const extraPayTotalFee = computed(() => {
|
||||
return extraPayList.value.reduce((pre, cur) => pre + cur.extraPayMoney, 0)
|
||||
})
|
||||
|
||||
function open(clueId, orderId) {
|
||||
try {
|
||||
show.value = true
|
||||
@@ -122,6 +160,9 @@ const orderSchema = ref([])
|
||||
function getFields() {
|
||||
getClueFieldList().then((data) => {
|
||||
const arr = useCrudSchemas(data).allSchemas.detailSchema
|
||||
if (arr.length % 2 != 0) {
|
||||
arr.push({})
|
||||
}
|
||||
clueSchema.value = [
|
||||
...arr,
|
||||
{
|
||||
@@ -140,6 +181,9 @@ function getFields() {
|
||||
|
||||
getOrderFieldList().then((data) => {
|
||||
const arr = useCrudSchemas(data).allSchemas.detailSchema
|
||||
if (arr.length % 2 != 0) {
|
||||
arr.push({})
|
||||
}
|
||||
orderSchema.value = [
|
||||
...arr,
|
||||
{
|
||||
|
||||
@@ -68,9 +68,14 @@
|
||||
<el-table :data="row.signProducts" stripe style="width: 900px">
|
||||
<el-table-column prop="productName" label="成交产品" />
|
||||
<el-table-column prop="specsName" label="产品规格" />
|
||||
<el-table-column prop="signNum" label="成交数量" />
|
||||
<el-table-column prop="warehouseName" label="发货仓库" />
|
||||
<el-table-column label="发货备注">
|
||||
<el-table-column prop="signNum" label="成交数量" width="100px" />
|
||||
<el-table-column prop="warehouseName" label="发货仓库" width="150px" />
|
||||
<el-table-column label="发货状态" width="100px">
|
||||
<template #default="scope">
|
||||
{{ scope.row.warehouseName ? '已发货' : '待发货' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发货备注" width="100px">
|
||||
<template #default="scope">
|
||||
<el-popover
|
||||
placement="top"
|
||||
@@ -335,7 +340,7 @@ function getOptions() {
|
||||
}
|
||||
const deliveryDialog = ref()
|
||||
function handleDelivery(row) {
|
||||
deliveryDialog.value.open(row.id)
|
||||
deliveryDialog.value.open(row.id, row.signNum)
|
||||
}
|
||||
|
||||
const userOptions = ref([])
|
||||
|
||||
@@ -179,7 +179,11 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const showSchema = computed(() => {
|
||||
const arr = [
|
||||
const arr1 = [...props.schema]
|
||||
if (arr1.length % 2 != 0) {
|
||||
arr1.push({})
|
||||
}
|
||||
const arr2 = [
|
||||
{
|
||||
field: 'requirement',
|
||||
label: '诉求',
|
||||
@@ -192,7 +196,7 @@ const showSchema = computed(() => {
|
||||
isEditor: true
|
||||
}
|
||||
]
|
||||
return [...props.schema, ...arr]
|
||||
return [...arr1, ...arr2]
|
||||
})
|
||||
|
||||
const followList = ref([])
|
||||
|
||||
@@ -42,7 +42,13 @@
|
||||
</el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="采购数量" prop="num">
|
||||
<el-input-number :min="1" v-model="form.num" placeholder="请输入" style="width: 100%" />
|
||||
<el-input-number
|
||||
:min="1"
|
||||
v-model="form.num"
|
||||
:controls="false"
|
||||
placeholder="请输入"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -51,6 +57,7 @@
|
||||
<el-form-item label="采购单价" prop="unitPrice">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
:controls="false"
|
||||
v-model="form.unitPrice"
|
||||
placeholder="请输入"
|
||||
style="width: 100%"
|
||||
|
||||
Reference in New Issue
Block a user