This commit is contained in:
weipengfei 2024-04-24 17:52:40 +08:00
parent d3d00a83fb
commit 6dbc59cbe3
23 changed files with 1747 additions and 35 deletions

View File

@ -62,9 +62,4 @@ watch(
.el-select.w-\[280px\]{
width: 280px;
}
.disabledEdit {
.el-form-item__content {
pointer-events: none;
}
}
</style>

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

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 零售单列表
export function apiCashierclassLists(params: any) {
return request.get({ url: '/retail/cashierclass/lists', params })
}
// 添加零售单
export function apiCashierclassAdd(params: any) {
return request.post({ url: '/retail/cashierclass/add', params })
}
// 编辑零售单
export function apiCashierclassEdit(params: any) {
return request.post({ url: '/retail/cashierclass/edit', params })
}
// 删除零售单
export function apiCashierclassDelete(params: any) {
return request.post({ url: '/retail/cashierclass/delete', params })
}
// 零售单详情
export function apiCashierclassDetail(params: any) {
return request.get({ url: '/retail/cashierclass/detail', params })
}

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

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 零售详情表列表
export function apiCashierinfoLists(params: any) {
return request.get({ url: '/retail/cashierinfo/lists', params })
}
// 添加零售详情表
export function apiCashierinfoAdd(params: any) {
return request.post({ url: '/retail/cashierinfo/add', params })
}
// 编辑零售详情表
export function apiCashierinfoEdit(params: any) {
return request.post({ url: '/retail/cashierinfo/edit', params })
}
// 删除零售详情表
export function apiCashierinfoDelete(params: any) {
return request.post({ url: '/retail/cashierinfo/delete', params })
}
// 零售详情表详情
export function apiCashierinfoDetail(params: any) {
return request.get({ url: '/retail/cashierinfo/detail', params })
}

View File

@ -208,6 +208,7 @@ export default defineComponent({
}
const deleteImg = (index: number) => {
if(disabled.value) return;
fileList.value.splice(index, 1)
handleChange()
}

View File

@ -1,7 +1,27 @@
@charset "UTF-8";
@import url(d:\里海数字乡村\webman-like\src\styles\dark.css);
@import url(d:\里海数字乡村\webman-like\src\styles\var.css);
@import url(d:\里海数字乡村\webman-like\src\styles\tailwind.css);
@import url(d:\里海数字乡村\ERP-admin\src\styles\dark.css);
@import url(d:\里海数字乡村\ERP-admin\src\styles\var.css);
@import url(d:\里海数字乡村\ERP-admin\src\styles\tailwind.css);
body {
@apply text-base text-tx-primary overflow-hidden min-w-[375px];
}
.form-tips {
@apply text-tx-secondary text-xs leading-6 mt-1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
visibility: hidden;
}
/* NProgress */
#nprogress .bar {
@apply bg-primary !important;
}
:root .el-overlay-dialog {
display: flex;
justify-content: center;
@ -146,23 +166,3 @@
border-color: var(--el-button-hover-border-color);
background-color: var(--el-button-hover-bg-color);
}
body {
@apply text-base text-tx-primary overflow-hidden min-w-[375px];
}
.form-tips {
@apply text-tx-secondary text-xs leading-6 mt-1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
visibility: hidden;
}
/* NProgress */
#nprogress .bar {
@apply bg-primary !important;
}

View File

@ -1 +1 @@
@import url(d:\里海数字乡村\webman-like\src\styles\dark.css);@import url(d:\里海数字乡村\webman-like\src\styles\var.css);@import url(d:\里海数字乡村\webman-like\src\styles\tailwind.css);:root .el-overlay-dialog{display:flex;justify-content:center;align-items:center;min-height:100%;position:static}:root .el-overlay-dialog .el-dialog{--el-dialog-content-font-size:var(--el-font-size-base);--el-dialog-margin-top:50px;max-width:calc(100vw - 30px);flex:none;display:flex;flex-direction:column;border-radius:5px}:root .el-overlay-dialog .el-dialog.body-padding .el-dialog__body{padding:0}:root .el-overlay-dialog .el-dialog .el-dialog__body{flex:1;padding:15px 20px}:root .el-overlay-dialog .el-dialog .el-dialog__header{font-size:var(--el-font-size-large)}:root .el-drawer{--el-drawer-padding-primary:16px}:root .el-drawer__header{margin-bottom:0;padding:13px 16px;border-bottom:1px solid var(--el-border-color-lighter)}:root .el-drawer__title{@apply text-tx-primary}:root .el-table{--el-table-header-text-color:var(--el-text-color-primary);--el-table-header-bg-color:var(--table-header-bg-color);font-size:var(--el-font-size-base)}:root .el-table thead th{font-weight:400}:root .el-input-group__prepend{background-color:var(--el-fill-color-blank)}:root .el-checkbox{--el-checkbox-font-size:var(--el-font-size-base)}:root .el-menu--popup-container.theme-light .el-menu .el-menu-item.is-active{@apply bg-primary-light-9 border-primary border-r-2}:root .el-menu--popup-container.theme-light .el-menu .el-menu-item:hover,:root .el-menu--popup-container.theme-light .el-menu .el-sub-menu__title:hover{color:var(--el-color-primary)}:root .el-menu--popup-container.theme-dark .el-menu .el-menu-item.is-active{@apply bg-primary}:root .el-message-box{--el-messagebox-width:350px}:root .el-date-editor{--el-date-editor-datetimerange-width:380px}:root .el-date-editor .el-range-input{font-size:var(--el-font-size-small)}:root .el-button--primary{--el-button-hover-link-text-color:var(--el-color-primary-light-3)}:root .el-button--success{--el-button-hover-link-text-color:var(--el-color-success-light-3)}:root .el-button--info{--el-button-hover-link-text-color:var(--el-color-info-light-3)}:root .el-button--warning{--el-button-hover-link-text-color:var(--el-color-warning-light-3)}:root .el-button--danger{--el-button-hover-link-text-color:var(--el-color-danger-light-3)}:root .el-image__error{font-size:12px}:root .el-tabs__nav-wrap::after{height:1px}:root .el-page-header__breadcrumb{margin-bottom:0}@media (max-width: 768px){.el-pagination>.el-pagination__jump{display:none !important}.el-pagination>.el-pagination__sizes{display:none !important}}.el-button{background-color:var(--el-button-bg-color, var(--el-color-white))}.el-button:focus{color:var(--el-button-text-color);border-color:var(--el-button-border-color);background-color:var(--el-button-bg-color)}.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color)}body{@apply text-base text-tx-primary overflow-hidden min-w-[375px]}.form-tips{@apply text-tx-secondary text-xs leading-6 mt-1}.clearfix:after{content:'';display:block;clear:both;visibility:hidden}#nprogress .bar{@apply bg-primary !important}
@import url(d:\里海数字乡村\ERP-admin\src\styles\dark.css);@import url(d:\里海数字乡村\ERP-admin\src\styles\var.css);@import url(d:\里海数字乡村\ERP-admin\src\styles\tailwind.css);body{@apply text-base text-tx-primary overflow-hidden min-w-[375px]}.form-tips{@apply text-tx-secondary text-xs leading-6 mt-1}.clearfix:after{content:'';display:block;clear:both;visibility:hidden}#nprogress .bar{@apply bg-primary !important}:root .el-overlay-dialog{display:flex;justify-content:center;align-items:center;min-height:100%;position:static}:root .el-overlay-dialog .el-dialog{--el-dialog-content-font-size:var(--el-font-size-base);--el-dialog-margin-top:50px;max-width:calc(100vw - 30px);flex:none;display:flex;flex-direction:column;border-radius:5px}:root .el-overlay-dialog .el-dialog.body-padding .el-dialog__body{padding:0}:root .el-overlay-dialog .el-dialog .el-dialog__body{flex:1;padding:15px 20px}:root .el-overlay-dialog .el-dialog .el-dialog__header{font-size:var(--el-font-size-large)}:root .el-drawer{--el-drawer-padding-primary:16px}:root .el-drawer__header{margin-bottom:0;padding:13px 16px;border-bottom:1px solid var(--el-border-color-lighter)}:root .el-drawer__title{@apply text-tx-primary}:root .el-table{--el-table-header-text-color:var(--el-text-color-primary);--el-table-header-bg-color:var(--table-header-bg-color);font-size:var(--el-font-size-base)}:root .el-table thead th{font-weight:400}:root .el-input-group__prepend{background-color:var(--el-fill-color-blank)}:root .el-checkbox{--el-checkbox-font-size:var(--el-font-size-base)}:root .el-menu--popup-container.theme-light .el-menu .el-menu-item.is-active{@apply bg-primary-light-9 border-primary border-r-2}:root .el-menu--popup-container.theme-light .el-menu .el-menu-item:hover,:root .el-menu--popup-container.theme-light .el-menu .el-sub-menu__title:hover{color:var(--el-color-primary)}:root .el-menu--popup-container.theme-dark .el-menu .el-menu-item.is-active{@apply bg-primary}:root .el-message-box{--el-messagebox-width:350px}:root .el-date-editor{--el-date-editor-datetimerange-width:380px}:root .el-date-editor .el-range-input{font-size:var(--el-font-size-small)}:root .el-button--primary{--el-button-hover-link-text-color:var(--el-color-primary-light-3)}:root .el-button--success{--el-button-hover-link-text-color:var(--el-color-success-light-3)}:root .el-button--info{--el-button-hover-link-text-color:var(--el-color-info-light-3)}:root .el-button--warning{--el-button-hover-link-text-color:var(--el-color-warning-light-3)}:root .el-button--danger{--el-button-hover-link-text-color:var(--el-color-danger-light-3)}:root .el-image__error{font-size:12px}:root .el-tabs__nav-wrap::after{height:1px}:root .el-page-header__breadcrumb{margin-bottom:0}@media (max-width: 768px){.el-pagination>.el-pagination__jump{display:none !important}.el-pagination>.el-pagination__sizes{display:none !important}}.el-button{background-color:var(--el-button-bg-color, var(--el-color-white))}.el-button:focus{color:var(--el-button-text-color);border-color:var(--el-button-border-color);background-color:var(--el-button-bg-color)}.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color)}

View File

@ -1,6 +1,7 @@
@import 'element.scss';
@import 'dark.css';
@import 'var.css';
@import 'public.scss';
@import 'element.scss';
@import 'tailwind.css';

View File

@ -60,6 +60,15 @@
</el-table-column>
<el-table-column label="物理类型" prop="column_type" />
<el-table-column label="必填" width="80">
<template #header>
<el-checkbox
:true-label="1"
:false-label="0"
:checked="is_required"
@change="handleAllRequired"
/>
<span class="ml-2">必填</span>
</template>
<template v-slot="{ row }">
<el-checkbox
v-model="row.is_required"
@ -69,6 +78,15 @@
</template>
</el-table-column>
<el-table-column label="插入" width="80">
<template #header>
<el-checkbox
:true-label="1"
:false-label="0"
:checked="is_insert"
@change="handleAllInsert"
/>
<span class="ml-2">插入</span>
</template>
<template v-slot="{ row }">
<el-checkbox
v-model="row.is_insert"
@ -78,6 +96,15 @@
</template>
</el-table-column>
<el-table-column label="编辑" width="80">
<template #header>
<el-checkbox
:true-label="1"
:false-label="0"
:checked="is_update"
@change="handleAllUpdate"
/>
<span class="ml-2">编辑</span>
</template>
<template v-slot="{ row }">
<el-checkbox
v-model="row.is_update"
@ -87,6 +114,15 @@
</template>
</el-table-column>
<el-table-column label="列表" width="80">
<template #header>
<el-checkbox
:true-label="1"
:false-label="0"
:checked="is_lists"
@change="handleAllLists"
/>
<span class="ml-2">列表</span>
</template>
<template v-slot="{ row }">
<el-checkbox
v-model="row.is_lists"
@ -96,11 +132,21 @@
</template>
</el-table-column>
<el-table-column label="查询" width="80">
<template #header>
<el-checkbox
:true-label="1"
:false-label="0"
:checked="is_query"
@change="handleAllQuery"
/>
<span class="ml-2">查询</span>
</template>
<template v-slot="{ row }">
<el-checkbox
v-model="row.is_query"
:true-label="1"
:false-label="0"
@change="handleQueryChange(row)"
/>
</template>
</el-table-column>
@ -525,4 +571,49 @@ const onSubmit = async () => {
}
getDetails()
const is_required = computed(()=>{
return formData.table_column.findIndex(item=>item.is_required==0) ? false : true
})
const handleAllRequired = (e:any)=>{
formData.table_column.forEach((item:any)=>{
item.is_required = e;
})
}
const is_insert = computed(()=>{
return formData.table_column.findIndex(item=>item.is_insert==0) ? false : true
})
const handleAllInsert = (e:any)=>{
formData.table_column.forEach((item:any)=>{
item.is_insert = e;
})
}
const is_update = computed(()=>{
return formData.table_column.findIndex(item=>item.is_update==0) ? false : true
})
const handleAllUpdate = (e:any)=>{
formData.table_column.forEach((item:any)=>{
item.is_update = e;
})
}
const is_lists = computed(()=>{
return formData.table_column.findIndex(item=>item.is_lists==0) ? false : true
})
const handleAllLists = (e:any)=>{
formData.table_column.forEach((item:any)=>{
item.is_lists = e;
})
}
const is_query = computed(()=>{
return formData.table_column.findIndex(item=>item.is_query==0) ? false : true
})
const handleAllQuery = (e:any)=>{
formData.table_column.forEach((item:any)=>{
item.is_query = e;
})
}
</script>

View File

@ -0,0 +1,114 @@
<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="name">
<el-input v-model="formData.name" clearable placeholder="请输入条码名称" :readonly="true"/>
</el-form-item>
<el-form-item label="拼音信息" prop="py">
<el-input v-model="formData.py" clearable placeholder="请输入拼音信息" :readonly="true"/>
</el-form-item>
<el-form-item label="条码内容" prop="code">
<el-input v-model="formData.code" clearable placeholder="请输入条码内容" :readonly="true"/>
</el-form-item>
<el-form-item label="条码类型" prop="type">
<el-select class="flex-1" v-model="formData.type" clearable placeholder="请选择条码类型" :disabled="true">
<el-option
v-for="(item, index) in dictData.code_type"
:key="index"
:label="item.name"
:value="parseInt(item.value)"
/>
</el-select>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="true"/>
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" :readonly="true"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" clearable placeholder="请输入排序" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="codeDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCodeAdd, apiCodeEdit, apiCodeDetail } from '@/api/code'
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: '',
name: '',
py: '',
code: '',
type: '',
data: '',
more: '',
sort: '',
})
//
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 apiCodeDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -62,7 +62,7 @@
<el-table-column label="条码名称" prop="name" show-overflow-tooltip />
<el-table-column label="拼音信息" prop="py" show-overflow-tooltip />
<el-table-column label="条码内容" prop="code" show-overflow-tooltip />
<el-table-column label="条码类型0:条形码 | 1:二维码" prop="type">
<el-table-column label="条码类型" prop="type">
<template #default="{ row }">
<dict-value :options="dictData.code_type" :value="row.type" />
</template>
@ -80,6 +80,13 @@
>
编辑
</el-button>
<el-button
type="primary"
link
@click="handleDetails(row)"
>
详情
</el-button>
<el-button
v-perms="['goods.code/delete']"
type="danger"
@ -97,6 +104,7 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detail-popup v-if="detailEdit" ref="detailRef" :dict-data="dictData" @success="getLists" @close="detailEdit = false" />
</div>
</template>
@ -107,10 +115,13 @@ import { apiCodeLists, apiCodeDelete } from '@/api/code'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './details.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
//
const showEdit = ref(false)
const detailEdit = ref(false)
//
@ -156,6 +167,14 @@ const handleEdit = async (data: any) => {
editRef.value?.setFormData(data)
}
//
const handleDetails = async (data: any) => {
detailEdit.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,355 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="商品详情"
:async="true"
width="80%"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-row>
<el-col :span="8">
<el-form-item label="商品名称" prop="name">
<el-input
v-model="formData.name"
clearable
placeholder="请输入商品名称"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="首拼字母" prop="py">
<el-input
v-model="formData.py"
clearable
placeholder="请输入首拼字母"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品编号" prop="number">
<el-input
v-model="formData.number"
clearable
placeholder="请输入商品编号"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="规格型号" prop="spec">
<el-input
v-model="formData.spec"
clearable
placeholder="请输入规格型号"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品分类" prop="class">
<el-cascader
style="width: 100%"
v-model="formData.class"
:options="classList"
:props="{
value: 'id',
label: 'name',
emitPath: false,
}"
placeholder="请选择商品分类"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品品牌" prop="brand">
<el-cascader
style="width: 100%"
v-model="formData.brand"
:options="brandList"
:props="{
value: 'id',
label: 'name',
emitPath: false,
}"
placeholder="请选择商品品牌"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品单位" prop="unit">
<el-cascader
style="width: 100%"
v-model="formData.unit"
:options="unitList"
:props="{
value: 'id',
label: 'name',
emitPath: false,
}"
placeholder="请选择商品单位"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="购货价格" prop="buy">
<el-input
v-model="formData.buy"
clearable
placeholder="请输入购货价格"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销货价格" prop="sell">
<el-input
v-model="formData.sell"
clearable
placeholder="请输入销货价格"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="零售价格" prop="retail">
<el-input
v-model="formData.retail"
clearable
placeholder="请输入零售价格"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="兑换积分" prop="integral">
<el-input
v-model="formData.integral"
clearable
placeholder="请输入兑换积分"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="条形码" prop="code">
<el-input
v-model="formData.code"
clearable
placeholder="请输入条形码"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="默认仓库" prop="warehouse">
<el-cascader
style="width: 100%"
v-model="formData.warehouse"
:options="warehouseList"
:props="{
value: 'id',
label: 'name',
emitPath: false,
}"
placeholder="请选择仓库"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品货位" prop="location">
<el-input
v-model="formData.location"
clearable
placeholder="请输入商品货位"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="库存阈值" prop="stocktip">
<el-input
v-model="formData.stocktip"
clearable
placeholder="请输入库存阈值"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="零售名称" prop="retail_name">
<el-input
v-model="formData.retail_name"
clearable
placeholder="请输入零售名称"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注信息" prop="data">
<el-input
v-model="formData.data"
clearable
placeholder="请输入备注信息"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="扩展信息" prop="more">
<el-input
v-model="formData.more"
clearable
placeholder="请输入扩展信息"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="排序" prop="sort">
<el-input
v-model="formData.sort"
clearable
placeholder="请输入排序"
:readonly="true"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="商品图片" prop="imgs">
<material-picker v-model="formData.imgs" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品详情" prop="details">
<material-picker v-model="formData.details" :limit="formData.details.length" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="goodsDetails">
import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue";
import { apiGoodsAdd, apiGoodsEdit, apiGoodsDetail } from "@/api/goods";
import { apiGoodsclassLists } from "@/api/goodsclass";
import { apiBrandLists } from "@/api/brand";
import { apiUnitLists } from "@/api/unit";
import { apiWarehouseLists } from "@/api/warehouse";
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: "",
name: "",
py: "",
number: "",
spec: "",
class: "",
brand: "",
unit: "",
buy: "",
sell: "",
retail: "",
integral: "",
code: "",
warehouse: "",
location: "",
stocktip: "",
retail_name: "",
imgs: "",
details: "",
data: "",
more: "",
sort: "",
});
//
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 classList = ref([]);
const getClassList = () => {
apiGoodsclassLists({}).then((res) => {
classList.value = res.lists;
});
};
getClassList();
const brandList = ref([]);
const getBrandList = () => {
apiBrandLists({}).then((res) => {
brandList.value = res.lists;
});
};
getBrandList();
const unitList = ref([]);
const getUnitList = () => {
apiUnitLists({}).then((res) => {
unitList.value = res.lists;
});
};
getUnitList();
const warehouseList = ref([]);
const getWarehouseList = () => {
apiWarehouseLists({}).then((res) => {
warehouseList.value = res.lists;
});
};
getWarehouseList();
const getDetail = async (row: Record<string, any>) => {
const data = await apiGoodsDetail({
id: row.id,
});
setFormData(data);
};
//
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
//
const handleClose = () => {
emit("close");
};
defineExpose({
open,
setFormData,
getDetail,
});
</script>

View File

@ -63,14 +63,14 @@
<el-table-column label="首拼字母" prop="py" show-overflow-tooltip />
<el-table-column label="商品编号" prop="number" show-overflow-tooltip />
<el-table-column label="规格型号" prop="spec" show-overflow-tooltip />
<el-table-column label="商品分类" prop="class" show-overflow-tooltip />
<el-table-column label="商品品牌" prop="brand" show-overflow-tooltip />
<el-table-column label="商品单位" prop="unit" show-overflow-tooltip />
<el-table-column label="商品分类" prop="class_name" show-overflow-tooltip />
<el-table-column label="商品品牌" prop="brand_name" show-overflow-tooltip />
<el-table-column label="商品单位" prop="unit_name" show-overflow-tooltip />
<el-table-column label="购货价格" prop="buy" show-overflow-tooltip />
<el-table-column label="销货价格" prop="sell" show-overflow-tooltip />
<el-table-column label="零售价格" prop="retail" show-overflow-tooltip />
<el-table-column label="条形码" prop="code" show-overflow-tooltip />
<el-table-column label="默认仓库" prop="warehouse" show-overflow-tooltip />
<el-table-column label="默认仓库" prop="warehouse_name" show-overflow-tooltip />
<el-table-column label="商品货位" prop="location" show-overflow-tooltip />
<el-table-column label="库存阈值" prop="stocktip" show-overflow-tooltip />
<el-table-column label="零售名称" prop="retail_name" show-overflow-tooltip />
@ -86,6 +86,13 @@
>
编辑
</el-button>
<el-button
type="primary"
link
@click="handleDetail(row)"
>
详情
</el-button>
<el-button
v-perms="['goods.goods/delete']"
type="danger"
@ -103,6 +110,7 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detail-popup v-if="showDetail" ref="detailRef" :dict-data="dictData" @close="showDetail = false" />
</div>
</template>
@ -113,10 +121,13 @@ import { apiGoodsLists, apiGoodsDelete } from '@/api/goods'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './details.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
//
const showEdit = ref(false)
const showDetail = ref(false)
//
@ -163,6 +174,14 @@ const handleEdit = async (data: any) => {
editRef.value?.setFormData(data)
}
//
const handleDetail = async (data: any) => {
showDetail.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.getDetail(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,164 @@
<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" :rules="formRules">
<el-form-item label="所属商户" prop="merchant">
<el-input v-model="formData.merchant" clearable placeholder="请输入所属商户" :readonly="true"/>
</el-form-item>
<el-form-item label="归属门店" prop="store_id">
<el-input v-model="formData.store_id" clearable placeholder="请输入归属门店" :readonly="true"/>
</el-form-item>
<el-form-item label="客户ID" prop="customer">
<el-input v-model="formData.customer" clearable placeholder="请输入客户ID" :readonly="true"/>
</el-form-item>
<el-form-item label="单据时间" prop="time">
<el-input v-model="formData.time" clearable placeholder="请输入单据时间" :readonly="true"/>
</el-form-item>
<el-form-item label="单据编号" prop="number">
<el-input v-model="formData.number" clearable placeholder="请输入单据编号" :readonly="true"/>
</el-form-item>
<el-form-item label="单据金额" prop="total">
<el-input v-model="formData.total" clearable placeholder="请输入单据金额" :readonly="true"/>
</el-form-item>
<el-form-item label="抵扣金额" prop="deduction_price">
<el-input v-model="formData.deduction_price" clearable placeholder="请输入抵扣金额" :readonly="true"/>
</el-form-item>
<el-form-item label="实际金额" prop="actual">
<el-input v-model="formData.actual" clearable placeholder="请输入实际金额" :readonly="true"/>
</el-form-item>
<el-form-item label="实收金额" prop="money">
<el-input v-model="formData.money" clearable placeholder="请输入实收金额" :readonly="true"/>
</el-form-item>
<el-form-item label="支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账" prop="pay_type">
<el-select class="flex-1" v-model="formData.pay_type" clearable placeholder="请选择支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账" :disabled="true">
<el-option
v-for="(item, index) in dictData.pay_type"
:key="index"
:label="item.name"
:value="parseInt(item.value)"
/>
</el-select>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="true"/>
</el-form-item>
<el-form-item label="审核状态[0:未审核|1:已审核]" prop="type">
<el-radio-group v-model="formData.type" placeholder="请选择审核状态[0:未审核|1:已审核]" :disabled="true">
<el-radio
v-for="(item, index) in dictData.auditing_type"
:key="index"
:label="parseInt(item.value)"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核人" prop="auditinguser">
<el-input v-model="formData.auditinguser" clearable placeholder="请输入审核人" :readonly="true"/>
</el-form-item>
<el-form-item label="审核时间" prop="auditingtime">
<el-date-picker
:readonly="true"
class="flex-1 !flex"
v-model="formData.auditingtime"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择审核时间">
</el-date-picker>
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="cashierclassDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCashierclassAdd, apiCashierclassEdit, apiCashierclassDetail } from '@/api/cashierclass'
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: '',
merchant: '',
store_id: '',
customer: '',
time: '',
number: '',
total: '',
deduction_price: '',
actual: '',
money: '',
pay_type: '',
data: '',
type: '',
auditinguser: '',
auditingtime: '',
more: '',
})
//
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]
}
}
//@ts-ignore
formData.auditingtime = timeFormat(formData.auditingtime,'yyyy-mm-dd hh:MM:ss')
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiCashierclassDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,225 @@
<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="merchant">
<el-input v-model="formData.merchant" clearable placeholder="请输入所属商户" :readonly="false"/>
</el-form-item>
<el-form-item label="归属门店" prop="store_id">
<el-input v-model="formData.store_id" clearable placeholder="请输入归属门店" :readonly="false"/>
</el-form-item>
<el-form-item label="客户ID" prop="customer">
<el-input v-model="formData.customer" clearable placeholder="请输入客户ID" :readonly="false"/>
</el-form-item>
<el-form-item label="单据时间" prop="time">
<el-input v-model="formData.time" clearable placeholder="请输入单据时间" :readonly="false"/>
</el-form-item>
<el-form-item label="单据编号" prop="number">
<el-input v-model="formData.number" clearable placeholder="请输入单据编号" :readonly="false"/>
</el-form-item>
<el-form-item label="单据金额" prop="total">
<el-input v-model="formData.total" clearable placeholder="请输入单据金额" :readonly="false"/>
</el-form-item>
<el-form-item label="抵扣金额" prop="deduction_price">
<el-input v-model="formData.deduction_price" clearable placeholder="请输入抵扣金额" :readonly="false"/>
</el-form-item>
<el-form-item label="实际金额" prop="actual">
<el-input v-model="formData.actual" clearable placeholder="请输入实际金额" :readonly="false"/>
</el-form-item>
<el-form-item label="实收金额" prop="money">
<el-input v-model="formData.money" clearable placeholder="请输入实收金额" :readonly="false"/>
</el-form-item>
<el-form-item label="支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账" prop="pay_type">
<el-select class="flex-1" v-model="formData.pay_type" clearable placeholder="请选择支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账" :disabled="false">
<el-option
v-for="(item, index) in dictData.pay_type"
:key="index"
:label="item.name"
:value="parseInt(item.value)"
/>
</el-select>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="false"/>
</el-form-item>
<el-form-item label="审核状态[0:未审核|1:已审核]" prop="type">
<el-radio-group v-model="formData.type" placeholder="请选择审核状态[0:未审核|1:已审核]" :disabled="false">
<el-radio
v-for="(item, index) in dictData.auditing_type"
:key="index"
:label="parseInt(item.value)"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核人" prop="auditinguser">
<el-input v-model="formData.auditinguser" clearable placeholder="请输入审核人" :readonly="false"/>
</el-form-item>
<el-form-item label="审核时间" prop="auditingtime">
<el-date-picker
:readonly="false"
class="flex-1 !flex"
v-model="formData.auditingtime"
clearable
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择审核时间">
</el-date-picker>
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" :readonly="false"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="cashierclassEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCashierclassAdd, apiCashierclassEdit, apiCashierclassDetail } from '@/api/cashierclass'
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: '',
merchant: '',
store_id: '',
customer: '',
time: '',
number: '',
total: '',
deduction_price: '',
actual: '',
money: '',
pay_type: '',
data: '',
type: '',
auditinguser: '',
auditingtime: '',
more: '',
})
//
const formRules = reactive<any>({
merchant: [{
required: true,
message: '请输入所属商户',
trigger: ['blur']
}],
customer: [{
required: true,
message: '请输入客户ID',
trigger: ['blur']
}],
time: [{
required: true,
message: '请输入单据时间',
trigger: ['blur']
}],
number: [{
required: true,
message: '请输入单据编号',
trigger: ['blur']
}],
total: [{
required: true,
message: '请输入单据金额',
trigger: ['blur']
}],
actual: [{
required: true,
message: '请输入实际金额',
trigger: ['blur']
}],
money: [{
required: true,
message: '请输入实收金额',
trigger: ['blur']
}],
pay_type: [{
required: true,
message: '请选择支付方式 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账',
trigger: ['blur']
}]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
//@ts-ignore
formData.auditingtime = timeFormat(formData.auditingtime,'yyyy-mm-dd hh:MM:ss')
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiCashierclassDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiCashierclassEdit(data)
: await apiCashierclassAdd(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,201 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="所属商户" prop="merchant">
<el-input class="w-[280px]" v-model="queryParams.merchant" clearable placeholder="请输入所属商户" />
</el-form-item>
<el-form-item label="归属门店" prop="store_id">
<el-input class="w-[280px]" v-model="queryParams.store_id" clearable placeholder="请输入归属门店" />
</el-form-item>
<el-form-item label="客户ID" prop="customer">
<el-input class="w-[280px]" v-model="queryParams.customer" clearable placeholder="请输入客户ID" />
</el-form-item>
<el-form-item label="单据时间" prop="time">
<el-input class="w-[280px]" v-model="queryParams.time" clearable placeholder="请输入单据时间" />
</el-form-item>
<el-form-item label="单据编号" prop="number">
<el-input class="w-[280px]" v-model="queryParams.number" clearable placeholder="请输入单据编号" />
</el-form-item>
<el-form-item label="制单人" prop="user">
<el-input class="w-[280px]" v-model="queryParams.user" clearable placeholder="请输入制单人" />
</el-form-item>
<el-form-item label="支付方式" prop="pay_type" tips=" 0余额 1微信 2小程序 3 h5 4支付宝 5 支付宝扫码 6 微信扫码 8先货后款 10对公转账">
<el-select class="w-[280px]"
v-model="queryParams.pay_type" clearable placeholder="请选择支付方式">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.pay_type"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="审核状态" prop="type">
<el-select class="w-[280px]"
v-model="queryParams.type" clearable placeholder="请选择审核状态">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.auditing_type"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="审核人" prop="auditinguser">
<el-input class="w-[280px]" v-model="queryParams.auditinguser" clearable placeholder="请输入审核人" />
</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="['retail.cashierclass/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['retail.cashierclass/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" />
<el-table-column label="所属商户" prop="merchant" show-overflow-tooltip />
<el-table-column label="归属门店" prop="store_id" show-overflow-tooltip />
<el-table-column label="客户ID" prop="customer" show-overflow-tooltip />
<el-table-column label="单据时间" prop="time" show-overflow-tooltip />
<el-table-column label="单据编号" prop="number" show-overflow-tooltip />
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
<el-table-column label="抵扣金额" prop="deduction_price" show-overflow-tooltip />
<el-table-column label="实际金额" prop="actual" show-overflow-tooltip />
<el-table-column label="实收金额" prop="money" show-overflow-tooltip />
<el-table-column label="制单人" prop="user" show-overflow-tooltip />
<el-table-column label="支付方式" prop="pay_type">
<template #default="{ row }">
<dict-value :options="dictData.pay_type" :value="row.pay_type" />
</template>
</el-table-column>
<el-table-column label="审核状态" prop="type">
<template #default="{ row }">
<dict-value :options="dictData.auditing_type" :value="row.type" />
</template>
</el-table-column>
<el-table-column label="审核人" prop="auditinguser" show-overflow-tooltip />
<el-table-column label="审核时间" prop="auditingtime">
<template #default="{ row }">
<span>{{ row.auditingtime ? timeFormat(row.auditingtime, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['retail.cashierclass/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['retail.cashierclass/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="cashierclassLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCashierclassLists, apiCashierclassDelete } from '@/api/cashierclass'
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({
merchant: '',
store_id: '',
customer: '',
time: '',
number: '',
user: '',
pay_type: '',
type: '',
auditinguser: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('pay_type,auditing_type')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCashierclassLists,
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 apiCashierclassDelete({ id })
getLists()
}
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="cashierinfoDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCashierinfoAdd, apiCashierinfoEdit, apiCashierinfoDetail } from '@/api/cashierinfo'
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 apiCashierinfoDetail({
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="cashierinfoEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCashierinfoAdd, apiCashierinfoEdit, apiCashierinfoDetail } from '@/api/cashierinfo'
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 apiCashierinfoDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiCashierinfoEdit(data)
: await apiCashierinfoAdd(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,153 @@
<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="pid">
<el-input class="w-[280px]" v-model="queryParams.pid" clearable placeholder="请输入所属ID" />
</el-form-item>
<el-form-item label="仓储" prop="room">
<el-input class="w-[280px]" v-model="queryParams.room" clearable placeholder="请输入仓储" />
</el-form-item>
<el-form-item label="商品" prop="goods">
<el-input class="w-[280px]" v-model="queryParams.goods" clearable placeholder="请输入商品" />
</el-form-item>
<el-form-item label="仓库" prop="warehouse">
<el-input class="w-[280px]" v-model="queryParams.warehouse" clearable placeholder="请输入仓库" />
</el-form-item>
<el-form-item label="串号" prop="serial">
<el-input class="w-[280px]" v-model="queryParams.serial" clearable placeholder="请输入串号" />
</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="['retail.cashierinfo/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['retail.cashierinfo/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="所属ID" prop="pid" show-overflow-tooltip />
<el-table-column label="仓储" prop="room" show-overflow-tooltip />
<el-table-column label="商品" prop="goods" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse" show-overflow-tooltip />
<el-table-column label="串号" prop="serial" 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="discount" show-overflow-tooltip />
<el-table-column label="总价" prop="total" show-overflow-tooltip />
<el-table-column label="备注" prop="data" show-overflow-tooltip />
<el-table-column label="扩展信息" prop="more" show-overflow-tooltip />
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
<!-- <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['retail.cashierinfo/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['retail.cashierinfo/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="cashierinfoLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCashierinfoLists, apiCashierinfoDelete } from '@/api/cashierinfo'
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({
pid: '',
room: '',
goods: '',
warehouse: '',
serial: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCashierinfoLists,
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 apiCashierinfoDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,119 @@
<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="name">
<el-input v-model="formData.name" clearable placeholder="请输入仓库名称" :readonly="true"/>
</el-form-item>
<el-form-item label="首拼信息" prop="py">
<el-input v-model="formData.py" clearable placeholder="请输入首拼信息" :readonly="true"/>
</el-form-item>
<el-form-item label="组织架构" prop="dept_id">
<el-input v-model="formData.dept_id" clearable placeholder="请输入组织架构" :readonly="true"/>
</el-form-item>
<el-form-item label="仓库编号" prop="number">
<el-input v-model="formData.number" clearable placeholder="请输入仓库编号" :readonly="true"/>
</el-form-item>
<el-form-item label="联系人员" prop="contacts">
<el-input v-model="formData.contacts" clearable placeholder="请输入联系人员" :readonly="true"/>
</el-form-item>
<el-form-item label="联系电话" prop="tel">
<el-input v-model="formData.tel" clearable placeholder="请输入联系电话" :readonly="true"/>
</el-form-item>
<el-form-item label="仓库地址" prop="add">
<el-input v-model="formData.add" clearable placeholder="请输入仓库地址" :readonly="true"/>
</el-form-item>
<el-form-item label="备注信息" prop="data">
<el-input v-model="formData.data" clearable placeholder="请输入备注信息" :readonly="true"/>
</el-form-item>
<el-form-item label="扩展信息" prop="more">
<el-input v-model="formData.more" clearable placeholder="请输入扩展信息" :readonly="true"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" clearable placeholder="请输入排序" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="warehouseDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiWarehouseAdd, apiWarehouseEdit, apiWarehouseDetail } from '@/api/warehouse'
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: '',
name: '',
py: '',
dept_id: '',
number: '',
contacts: '',
tel: '',
add: '',
data: '',
more: '',
sort: '',
})
//
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 apiWarehouseDetail({
id: row.id
})
setFormData(data)
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -80,6 +80,13 @@
>
编辑
</el-button>
<el-button
type="primary"
link
@click="handleDetails(row)"
>
详情
</el-button>
<el-button
v-perms="['warehouse.warehouse/delete']"
type="danger"
@ -97,6 +104,7 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<DetailPopup v-if="detailEdit" ref="detailRef" :dict-data="dictData" @success="getLists" @close="detailEdit = false" />
</div>
</template>
@ -107,10 +115,13 @@ import { apiWarehouseLists, apiWarehouseDelete } from '@/api/warehouse'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './details.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
//
const showEdit = ref(false)
const detailEdit = ref(false)
//
@ -159,6 +170,14 @@ const handleEdit = async (data: any) => {
editRef.value?.setFormData(data)
}
//
const handleDetails = async (data: any) => {
detailEdit.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')