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> <template>
<div class="edit-popup"> <div class="edit-popup">
<popup ref="popupRef" :async="true" width="550px" @close="handleClose" :bottom-btn="false"> <popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :bottom-btn="false">
<el-descriptions class="margin-top" :title="popupTitle" :column="1" border> <el-descriptions class="margin-top" :title="popupTitle" :column="3" border>
<el-descriptions-item label="条码名称"> <el-descriptions-item label="商品名称">
{{ formData.name }} {{ formData.name }}
</el-descriptions-item> </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 }} {{ formData.code }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="条码类型"> <!-- <el-descriptions-item label="默认仓库">
<dict-value :options="dictData.code_type" :value="formData.type" /> {{ formData.unit }}
</el-descriptions-item> -->
<el-descriptions-item label="商品货位">
{{ formData.location }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="备注信息"> <el-descriptions-item label="库存阈值">
{{ formData.data }} {{ formData.stocktip }}
</el-descriptions-item>
<el-descriptions-item label="零售名称">
{{ formData.retail_name }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="扩展信息"> <el-descriptions-item label="扩展信息">
{{ formData.more }} {{ formData.more }}
@ -20,6 +59,12 @@
<el-descriptions-item label="排序"> <el-descriptions-item label="排序">
{{ formData.sort }} {{ formData.sort }}
</el-descriptions-item> </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> </el-descriptions>
</popup> </popup>
</div> </div>
@ -46,16 +91,32 @@ const popupTitle = computed(() => {
// //
const formData = reactive({ const formData = reactive({
id: '', id: "",
name: '', name: "",
py: '', py: "",
code: '', number: "",
type: '', spec: "",
data: '', class: "",
more: '', brand: "",
sort: '', 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>({ const formRules = reactive<any>({
name: [{ 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="请选择商品单位" /> }" placeholder="请选择商品单位" />
</el-form-item> </el-form-item>
</el-col> </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-col :span="8">
<el-form-item label="购货价格" prop="buy"> <el-form-item label="购货价格" prop="buy">
<el-input v-model="formData.buy" clearable placeholder="请输入购货价格" /> <el-input v-model="formData.buy" clearable placeholder="请输入购货价格" />
@ -132,6 +138,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-dialog v-model="showDialog" title="选择标签" width="70%">
<dialogTable multipleChoice :config="goods_label" @customEvent="customEvent">
</dialogTable>
</el-dialog>
</popup> </popup>
</div> </div>
</template> </template>
@ -144,7 +154,7 @@ import { apiGoodsclassLists } from "@/api/goodsclass";
import { apiBrandLists } from "@/api/brand"; import { apiBrandLists } from "@/api/brand";
import { apiUnitLists } from "@/api/unit"; import { apiUnitLists } from "@/api/unit";
import { apiWarehouseLists } from "@/api/warehouse"; import { apiWarehouseLists } from "@/api/warehouse";
import { timeFormat } from "@/utils/util"; import { goods_label } from "@/components/dialogTable/dialogTableConfig"
import type { PropType } from "vue"; import type { PropType } from "vue";
defineProps({ defineProps({
dictData: { dictData: {
@ -156,6 +166,7 @@ const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>(); const formRef = shallowRef<FormInstance>();
const popupRef = shallowRef<InstanceType<typeof Popup>>(); const popupRef = shallowRef<InstanceType<typeof Popup>>();
const mode = ref("add"); const mode = ref("add");
const showDialog = ref(false)
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
@ -182,6 +193,8 @@ const formData = reactive({
location: "", location: "",
stocktip: "", stocktip: "",
retail_name: "", retail_name: "",
sys_labels_text: "",
sys_labels: "",
imgs: "", imgs: "",
details: "", details: "",
data: "", data: "",
@ -189,6 +202,20 @@ const formData = reactive({
sort: "", 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>({ const formRules = reactive<any>({
name: [ name: [

View File

@ -52,8 +52,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品名称" prop="name" show-overflow-tooltip /> <el-table-column label="商品名称" prop="name" show-overflow-tooltip />
<el-table-column label="首拼字母" prop="py" 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="number" show-overflow-tooltip /> -->
<el-table-column label="规格型号" prop="spec" 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="class_name" show-overflow-tooltip />
<el-table-column label="商品品牌" prop="brand_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="buy" show-overflow-tooltip />
<el-table-column label="销货价格" prop="sell" 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="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="code" show-overflow-tooltip />
<el-table-column label="默认仓库" prop="warehouse_name" 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="location" show-overflow-tooltip /> -->
<el-table-column label="库存阈值" prop="stocktip" 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="data" show-overflow-tooltip />
<el-table-column label="排序" prop="sort" show-overflow-tooltip /> <el-table-column label="排序" prop="sort" show-overflow-tooltip />
<el-table-column label="操作" width="170" fixed="right"> <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 v-perms="['goods.goods/edit']" type="primary" link @click="handleEdit(row)">
编辑 编辑
</el-button> </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 v-perms="['goods.goods/delete']" type="danger" link @click="handleDelete(row.id)">
删除 删除
</el-button> </el-button>
<el-button link @click="handleDetail(row)">
详情
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -99,7 +100,7 @@ import { apiGoodsLists, apiGoodsDelete } from '@/api/goods'
import { timeFormat } from '@/utils/util' import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
import DetailPopup from './details.vue' import DetailPopup from './detail.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>() const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
@ -156,8 +157,8 @@ const handleEdit = async (data: any) => {
const handleDetail = async (data: any) => { const handleDetail = async (data: any) => {
showDetail.value = true showDetail.value = true
await nextTick() await nextTick()
detailRef.value?.open() detailRef.value?.open('edit')
detailRef.value?.getDetail(data) detailRef.value?.setFormData(data)
} }
// //

View File

@ -39,6 +39,28 @@
{{ formData.auditingtime }} {{ formData.auditingtime }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </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> </popup>
</div> </div>
</template> </template>
@ -46,6 +68,8 @@
<script lang="ts" setup name="brandEdit"> <script lang="ts" setup name="brandEdit">
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import { usePaging } from '@/hooks/usePaging'
import { apiCashierinfoLists } from '@/api/cashierinfo'
defineProps({ defineProps({
dictData: { dictData: {
type: Object as PropType<Record<string, any[]>>, type: Object as PropType<Record<string, any[]>>,
@ -55,7 +79,13 @@ defineProps({
const emit = defineEmits(['success', 'close']) const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add') const mode = ref('add')
let pid;
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCashierinfoLists,
params: { pid: pid }
})
// //
const popupTitle = computed(() => { const popupTitle = computed(() => {
@ -97,13 +127,19 @@ const formRules = reactive<any>({
// //
const setFormData = async (data: Record<any, any>) => { const setFormData = async (data: Record<any, any>) => {
console.log(data.id, 'pid')
return
for (const key in formData) { for (const key in formData) {
if (data[key] != null && data[key] != undefined) { if (data[key] != null && data[key] != undefined) {
//@ts-ignore //@ts-ignore
formData[key] = data[key] 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"> <script lang="ts" setup name="cashierclassLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' 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 { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
@ -173,10 +173,11 @@ const handleEdit = async (data: any) => {
// //
const handleDetail = async (data) => { const handleDetail = async (data) => {
let res = await apiCashierclassDetail({ id: data.id })
showDetail.value = true showDetail.value = true
await nextTick() await nextTick()
detailRef.value?.open('edit') detailRef.value?.open('edit')
detailRef.value?.setFormData(data) detailRef.value?.setFormData(res)
} }
// //

View File

@ -1,13 +1,6 @@
<template> <template>
<div class="edit-popup"> <div class="edit-popup">
<popup <popup ref="popupRef" title="详情" :async="true" width="550px" :cancelButtonText="false" :confirmButtonText="false">
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px"> <el-form ref="formRef" :model="formData" label-width="90px">
</el-form> </el-form>
@ -18,8 +11,7 @@
<script lang="ts" setup name="cashierinfoDETAILS"> <script lang="ts" setup name="cashierinfoDETAILS">
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { apiCashierinfoAdd, apiCashierinfoEdit, apiCashierinfoDetail } from '@/api/cashierinfo' import { apiCashierinfoDetail } from '@/api/cashierinfo'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue' import type { PropType } from 'vue'
defineProps({ defineProps({
dictData: { dictData: {