This commit is contained in:
weipengfei 2024-05-11 16:09:37 +08:00
commit baa7abcc77
7 changed files with 165 additions and 402 deletions

View File

@ -1,18 +1,57 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :async="true" width="550px" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="1" border>
<el-descriptions-item label="条码名称">
<popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="3" border>
<el-descriptions-item label="商品名称">
{{ formData.name }}
</el-descriptions-item>
<el-descriptions-item label="条码内容">
<el-descriptions-item label="商品编号">
{{ formData.number }}
</el-descriptions-item>
<el-descriptions-item label="规格型号">
{{ formData.spec }}
</el-descriptions-item>
<el-descriptions-item label="商品分类">
{{ formData.class }}
</el-descriptions-item>
<el-descriptions-item label="商品品牌">
{{ formData.brand }}
</el-descriptions-item>
<el-descriptions-item label="商品单位">
{{ formData.unit }}
</el-descriptions-item>
<el-descriptions-item label="标签">
{{ formData.sys_labels_text }}
</el-descriptions-item>
<el-descriptions-item label="购货价格">
{{ formData.buy }}
</el-descriptions-item>
<el-descriptions-item label="销货价格">
{{ formData.sell }}
</el-descriptions-item>
<el-descriptions-item label="零售价格">
{{ formData.retail }}
</el-descriptions-item>
<el-descriptions-item label="兑换积分">
{{ formData.integral }}
</el-descriptions-item>
<el-descriptions-item label="税率">
{{ formData.tax_rate }}
</el-descriptions-item>
<el-descriptions-item label="条形码">
{{ formData.code }}
</el-descriptions-item>
<el-descriptions-item label="条码类型">
<dict-value :options="dictData.code_type" :value="formData.type" />
<!-- <el-descriptions-item label="默认仓库">
{{ formData.unit }}
</el-descriptions-item> -->
<el-descriptions-item label="商品货位">
{{ formData.location }}
</el-descriptions-item>
<el-descriptions-item label="备注信息">
{{ formData.data }}
<el-descriptions-item label="库存阈值">
{{ formData.stocktip }}
</el-descriptions-item>
<el-descriptions-item label="零售名称">
{{ formData.retail_name }}
</el-descriptions-item>
<el-descriptions-item label="扩展信息">
{{ formData.more }}
@ -20,6 +59,12 @@
<el-descriptions-item label="排序">
{{ formData.sort }}
</el-descriptions-item>
<el-descriptions-item label="商品图片">
<material-picker v-model="formData.imgs" disabled />
</el-descriptions-item>
<el-descriptions-item label="商品详情">
<material-picker v-model="formData.details" disabled />
</el-descriptions-item>
</el-descriptions>
</popup>
</div>
@ -46,16 +91,32 @@ const popupTitle = computed(() => {
//
const formData = reactive({
id: '',
name: '',
py: '',
code: '',
type: '',
data: '',
more: '',
sort: '',
})
id: "",
name: "",
py: "",
number: "",
spec: "",
class: "",
brand: "",
unit: "",
buy: "",
sell: "",
retail: "",
integral: "",
code: "",
tax_rate: "",
warehouse: "",
location: "",
stocktip: "",
retail_name: "",
sys_labels_text: "",
sys_labels: "",
imgs: "",
details: "",
data: "",
more: "",
sort: "",
});
//
const formRules = reactive<any>({
name: [{

View File

@ -1,355 +0,0 @@
<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

@ -51,6 +51,12 @@
}" placeholder="请选择商品单位" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="标签" prop="sys_labels">
<el-input v-model="formData.sys_labels_text" readonly @click="showDialog = true" clearable
placeholder="请输入标签" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="购货价格" prop="buy">
<el-input v-model="formData.buy" clearable placeholder="请输入购货价格" />
@ -132,6 +138,10 @@
</el-col>
</el-row>
</el-form>
<el-dialog v-model="showDialog" title="选择标签" width="70%">
<dialogTable multipleChoice :config="goods_label" @customEvent="customEvent">
</dialogTable>
</el-dialog>
</popup>
</div>
</template>
@ -144,7 +154,7 @@ 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 { goods_label } from "@/components/dialogTable/dialogTableConfig"
import type { PropType } from "vue";
defineProps({
dictData: {
@ -156,6 +166,7 @@ const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>();
const popupRef = shallowRef<InstanceType<typeof Popup>>();
const mode = ref("add");
const showDialog = ref(false)
//
const popupTitle = computed(() => {
@ -182,6 +193,8 @@ const formData = reactive({
location: "",
stocktip: "",
retail_name: "",
sys_labels_text: "",
sys_labels: "",
imgs: "",
details: "",
data: "",
@ -189,6 +202,20 @@ const formData = reactive({
sort: "",
});
const customEvent = (e) => {
formData.sys_labels = []
let text = []
e.forEach(item => {
formData.sys_labels.push(item.id)
text.push(item.name)
});
formData.sys_labels_text = text.join(',')
formData.sys_labels = formData.sys_labels.join(',')
showDialog.value = false
}
//
const formRules = reactive<any>({
name: [

View File

@ -52,8 +52,8 @@
</template>
</el-table-column>
<el-table-column label="商品名称" prop="name" show-overflow-tooltip />
<el-table-column label="首拼字母" prop="py" show-overflow-tooltip />
<el-table-column label="商品编号" prop="number" show-overflow-tooltip />
<!-- <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_name" show-overflow-tooltip />
<el-table-column label="商品品牌" prop="brand_name" show-overflow-tooltip />
@ -61,11 +61,12 @@
<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="sys_labels_text" show-overflow-tooltip />
<el-table-column label="条形码" prop="code" 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="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 />
<!-- <el-table-column label="零售名称" prop="retail_name" show-overflow-tooltip /> -->
<el-table-column label="备注信息" prop="data" show-overflow-tooltip />
<el-table-column label="排序" prop="sort" show-overflow-tooltip />
<el-table-column label="操作" width="170" fixed="right">
@ -73,12 +74,12 @@
<el-button v-perms="['goods.goods/edit']" type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button type="primary" link @click="handleDetail(row)">
详情
</el-button>
<el-button v-perms="['goods.goods/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
<el-button link @click="handleDetail(row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -99,7 +100,7 @@ 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'
import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
@ -156,8 +157,8 @@ const handleEdit = async (data: any) => {
const handleDetail = async (data: any) => {
showDetail.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.getDetail(data)
detailRef.value?.open('edit')
detailRef.value?.setFormData(data)
}
//

View File

@ -39,6 +39,28 @@
{{ formData.auditingtime }}
</el-descriptions-item>
</el-descriptions>
<div class="mt-4">
<el-table :data="pager.lists">
<!-- <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_name" show-overflow-tooltip />
<el-table-column label="仓库" prop="warehouse" show-overflow-tooltip />
<el-table-column label="串号" prop="cashier_number" 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>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</popup>
</div>
</template>
@ -46,6 +68,8 @@
<script lang="ts" setup name="brandEdit">
import Popup from '@/components/popup/index.vue'
import type { PropType } from 'vue'
import { usePaging } from '@/hooks/usePaging'
import { apiCashierinfoLists } from '@/api/cashierinfo'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
@ -55,7 +79,13 @@ defineProps({
const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
let pid;
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCashierinfoLists,
params: { pid: pid }
})
//
const popupTitle = computed(() => {
@ -97,13 +127,19 @@ const formRules = reactive<any>({
//
const setFormData = async (data: Record<any, any>) => {
console.log(data.id, 'pid')
return
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
pid = data.id
console.log(pid, 'pid')
// let res = await apiCashierinfoLists({ pid: data.id })
getLists()
}

View File

@ -114,7 +114,7 @@
<script lang="ts" setup name="cashierclassLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCashierclassLists, apiCashierclassDelete, apiCashierclassAuditing } from '@/api/cashierclass'
import { apiCashierclassLists, apiCashierclassDelete, apiCashierclassAuditing, apiCashierclassDetail } from '@/api/cashierclass'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
@ -173,10 +173,11 @@ const handleEdit = async (data: any) => {
//
const handleDetail = async (data) => {
let res = await apiCashierclassDetail({ id: data.id })
showDetail.value = true
await nextTick()
detailRef.value?.open('edit')
detailRef.value?.setFormData(data)
detailRef.value?.setFormData(res)
}
//

View File

@ -1,13 +1,6 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<popup ref="popupRef" title="详情" :async="true" width="550px" :cancelButtonText="false" :confirmButtonText="false">
<el-form ref="formRef" :model="formData" label-width="90px">
</el-form>
@ -18,8 +11,7 @@
<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 { apiCashierinfoDetail } from '@/api/cashierinfo'
import type { PropType } from 'vue'
defineProps({
dictData: {