This commit is contained in:
mkm 2024-08-13 17:59:30 +08:00
parent 0481704e9a
commit 2c149af25a
12 changed files with 917 additions and 5 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.7:8545'
VITE_APP_BASE_URL='http://192.168.1.22:8545'
# VITE_APP_BASE_URL='https://ceshi-multi-store.lihaink.cn'

View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 商品调拨列表
export function apiInventoryTransferLists(params: any) {
return request.get({ url: '/inventory_transfer/inventorytransfer/lists', params })
}
// 添加商品调拨
export function apiInventoryTransferAdd(params: any) {
return request.post({ url: '/inventory_transfer/inventorytransfer/add', params })
}
// 编辑商品调拨
export function apiInventoryTransferEdit(params: any) {
return request.post({ url: '/inventory_transfer/inventorytransfer/edit', params })
}
// 删除商品调拨
export function apiInventoryTransferDelete(params: any) {
return request.post({ url: '/inventory_transfer/inventorytransfer/delete', params })
}
// 商品调拨详情
export function apiInventoryTransferDetail(params: any) {
return request.get({ url: '/inventory_transfer/inventorytransfer/detail', params })
}

View File

@ -0,0 +1,107 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="商品" prop="product_id">
<el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="true"/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/>
</el-form-item>
<el-form-item label="更新前" prop="before_nums">
<el-input v-model="formData.before_nums" clearable placeholder="请输入更新前" :readonly="true"/>
</el-form-item>
<el-form-item label="更新后" prop="after_nums">
<el-input v-model="formData.after_nums" clearable placeholder="请输入更新后" :readonly="true"/>
</el-form-item>
<el-form-item label="1商户2仓库" prop="type">
<el-input v-model="formData.type" clearable placeholder="请输入1商户2仓库" :readonly="true"/>
</el-form-item>
<el-form-item label="转出id" prop="one_id">
<el-input v-model="formData.one_id" clearable placeholder="请输入转出id" :readonly="true"/>
</el-form-item>
<el-form-item label="转入id" prop="two_id">
<el-input v-model="formData.two_id" clearable placeholder="请输入转入id" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="inventoryTransferDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiInventoryTransferAdd, apiInventoryTransferEdit, apiInventoryTransferDetail } from '@/api/inventory_transfer'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const formData = reactive({
id: '',
product_id: '',
nums: '',
before_nums: '',
after_nums: '',
type: '',
one_id: '',
two_id: '',
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiInventoryTransferDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,260 @@
<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="product_id">
<el-input
v-model="formData.product_name"
clearable
placeholder="请选择商品"
:readonly="false"
@click="showProduct = true"
/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="formData.nums"
clearable
placeholder="请输入数量"
:readonly="false"
/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="formData.type"
clearable
placeholder="请选择类型"
@change="handleType"
>
<el-option label="商户" value="1" />
<el-option label="仓库" value="2" />
</el-select>
</el-form-item>
<el-form-item label="转出方门店" prop="one_id" v-if="formData.type == 1">
<el-input
v-model="formData.one_name"
clearable
placeholder="请选择转出方"
:readonly="false"
@click="showStore = true"
/>
</el-form-item>
<el-form-item label="转入方门店" prop="two_id" v-if="formData.type == 1">
<el-input
v-model="formData.two_name"
clearable
placeholder="请选择转入方"
:readonly="false"
@click="showStoreTwo = true"
/>
</el-form-item>
<el-form-item label="转出方仓库" prop="one_id" v-if="formData.type == 2">
<el-input
v-model="formData.one_name"
clearable
placeholder="请选择转出方"
:readonly="false"
@click="showWarehouse = true"
/>
</el-form-item>
<el-form-item label="转入方仓库" prop="two_id" v-if="formData.type == 2">
<el-input
v-model="formData.two_name"
clearable
placeholder="请选择转入方"
:readonly="false"
@click="showWarehouseTwo = true"
/>
</el-form-item>
</el-form>
</popup>
<el-dialog v-model="showStore" title="选择门店" width="70%">
<store-pop @onBindStore="onBindStore"></store-pop>
</el-dialog>
<el-dialog v-model="showStoreTwo" title="选择门店" width="70%">
<store-pop @onBindStore="onBindStoreTwo"></store-pop>
</el-dialog>
<el-dialog v-model="showProduct" title="选择商品" width="70%">
<product-pop @onBindStore="onBindProduct"></product-pop>
</el-dialog>
<el-dialog v-model="showWarehouse" title="选择仓库1" width="70%">
<warehouse-pop @onBindWarehouse="onBindWarehouse"></warehouse-pop>
</el-dialog>
<el-dialog v-model="showWarehouseTwo" title="选择仓库2" width="70%">
<warehouse-pop @onBindWarehouse="onBindWarehouseTwo"></warehouse-pop>
</el-dialog>
</div>
</template>
<script lang="ts" setup name="inventoryTransferEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiInventoryTransferAdd,
apiInventoryTransferEdit,
apiInventoryTransferDetail
} from '@/api/inventory_transfer'
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 showProduct = ref(false) //
const showStore = ref(false) //
const showStoreTwo = ref(false) //
const showWarehouse = ref(false) //
const showWarehouseTwo = ref(false) //
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑商品调拨' : '新增商品调拨'
})
//
const formData = reactive({
id: '',
product_id: '',
product_name: '',
nums: '',
before_nums: '',
after_nums: '',
type: '',
one_id: '',
one_name: '',
two_id: '',
two_name: '',
warehouse_name: '',
warehouse_name_two: ''
})
//
const formRules = reactive<any>({
product_id: [
{
required: true,
message: '请输入商品',
trigger: ['blur']
}
],
nums: [
{
required: true,
message: '请输入数量',
trigger: ['blur']
}
],
type: [
{
required: true,
message: '请输入1商户2仓库',
trigger: ['blur']
}
],
one_id: [
{
required: true,
message: '请输入转出id',
trigger: ['blur']
}
],
two_id: [
{
required: true,
message: '请输入转入id',
trigger: ['blur']
}
]
})
const onBindProduct = (e: any[]) => {
formData.product_name = e[0].store_name
formData.product_id = e[0].id
showProduct.value = false
}
//
const onBindStore = (e: any[]) => {
formData.one_id = e[0].id
formData.one_name = e[0].name
showStore.value = false
}
const onBindStoreTwo = (e: any[]) => {
formData.two_id = e[0].id
formData.two_name = e[0].name
showStoreTwo.value = false
}
//
const onBindWarehouse = (e: any[]) => {
formData.one_name = e.name
formData.one_id = e.id
showWarehouse.value = false
}
//
const onBindWarehouseTwo = (e: any[]) => {
formData.two_name = e.name
formData.two_id = e.id
showWarehouseTwo.value = false
}
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const handleType = (e) => {
formData.one_id = 0
formData.two_id = 0
formData.one_name = ''
formData.two_name = ''
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiInventoryTransferDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData }
mode.value == 'edit'
? await apiInventoryTransferEdit(data)
: await apiInventoryTransferAdd(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,148 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="商品" prop="product_id">
<el-input
class="w-[280px]"
v-model="queryParams.product_id"
clearable
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
class="w-[280px]"
v-model="queryParams.type"
clearable
placeholder="请选择类型"
>
<el-option label="商户" value="1" />
<el-option label="仓库" value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['inventory_transfer/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['inventory_transfer/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="" prop="id" show-overflow-tooltip />
<el-table-column label="商品" prop="product_id" show-overflow-tooltip />
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
<el-table-column label="转出方" prop="one_id" show-overflow-tooltip />
<el-table-column label="转入方" prop="two_id" show-overflow-tooltip />
<el-table-column label="类型" prop="type" show-overflow-tooltip />
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['inventory_transfer/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['inventory_transfer/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
</div>
</template>
<script lang="ts" setup name="inventoryTransferLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiInventoryTransferLists, apiInventoryTransferDelete } from '@/api/inventory_transfer'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
product_id: '',
type: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiInventoryTransferLists,
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 apiInventoryTransferDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -11,6 +11,14 @@
placeholder="请输入商品名称"
/>
</el-form-item>
<el-form-item label="商品条码" prop="bar_code">
<el-input
class="w-[280px]"
v-model="queryParams.bar_code"
clearable
placeholder="请输入商品条码"
/>
</el-form-item>
<el-form-item label="商品分类" prop="store_name">
<el-cascader
class="w-[280px]"
@ -26,6 +34,12 @@
<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="apiStoreProductLists"
:params="queryParams"
:page-size="pager.size"
/>
</el-form-item>
</el-form>
</el-card>
@ -210,7 +224,8 @@ const detailsRef = ref(null)
//
const queryParams = reactive({
store_name: '',
class_all: ''
class_all: '',
bar_code: ''
})
//
@ -301,5 +316,7 @@ const handleDelete = async (id: number | any[]) => {
getLists()
}
getLists()
onMounted(() => {
getLists()
})
</script>

View File

@ -0,0 +1,81 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="storeExtractDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiStoreExtractAdd, apiStoreExtractEdit, apiStoreExtractDetail } from '@/api/store_extract'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const formData = reactive({
id: '',
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiStoreExtractDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,103 @@
<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>
</popup>
</div>
</template>
<script lang="ts" setup name="storeExtractEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiStoreExtractAdd, apiStoreExtractEdit, apiStoreExtractDetail } from '@/api/store_extract'
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: '',
})
//
const formRules = reactive<any>({
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiStoreExtractDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiStoreExtractEdit(data)
: await apiStoreExtractAdd(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,143 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button
v-perms="['store_extract.store_extract/add']"
type="primary"
@click="handleAdd"
>
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['store_extract.store_extract/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="id" prop="id" show-overflow-tooltip />
<el-table-column label="提现金额" prop="extract_price" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip />
<el-table-column label="当前金额" prop="balance" show-overflow-tooltip />
<el-table-column
label="更新前金额"
prop="before_balance"
show-overflow-tooltip
/>
<el-table-column
label="-1 未通过 0 审核中 1 通过"
prop="status"
show-overflow-tooltip
/>
<el-table-column
label="0 未转账 1 已转账"
prop="pay_status"
show-overflow-tooltip
/>
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<!-- <el-button
v-perms="['store_extract.store_extract/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button> -->
<!-- <el-button
v-perms="['store_extract.store_extract/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
</div>
</template>
<script lang="ts" setup name="storeExtractLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiStoreExtractLists, apiStoreExtractDelete } from '@/api/store_extract'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiStoreExtractLists,
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 apiStoreExtractDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -23,6 +23,14 @@
@change="resetPage"
/>
</el-form-item>
<el-form-item label="商品条码" prop="bar_code">
<el-input
class="w-[280px]"
v-model="queryParams.bar_code"
clearable
placeholder="请输入商品条码"
/>
</el-form-item>
<el-form-item label="排序" prop="order_by">
<el-select
v-model="queryParams.order_by"
@ -158,6 +166,7 @@ const queryParams = reactive({
store_name: '',
class_all: '',
warehouse_id: '',
bar_code: '',
order_by: '',
field: 'nums'
})

View File

@ -41,6 +41,14 @@
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="商品条码" prop="bar_code">
<el-input
class="w-[280px]"
v-model="queryParams.bar_code"
clearable
placeholder="请输入商品条码"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
@ -175,7 +183,8 @@ const queryParams = reactive({
warehouse_id: '',
product_id: '',
financial_pm: 1,
store_id: ''
store_id: '',
bar_code: ''
})
//

View File

@ -41,6 +41,14 @@
placeholder="请输入商品"
/>
</el-form-item>
<el-form-item label="商品条码" prop="bar_code">
<el-input
class="w-[280px]"
v-model="queryParams.bar_code"
clearable
placeholder="请输入商品条码"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
@ -162,7 +170,8 @@ const queryParams = reactive({
warehouse_id: '',
product_id: '',
financial_pm: 0,
store_id: ''
store_id: '',
bar_code: ''
})
//