This commit is contained in:
dzc committed 2025-04-10 09:57:09 +08:00
1 parent 24b5dfe141
commit 0b3614077f
6 files changed
+64 -93

No files matched your search

+22 -16
View File
@@ -2,20 +2,6 @@
<el-dialog :title="form.id ? '编辑' : '新增'" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="100px" v-loading="loading">
<el-row :gutter="24">
<el-col :span="24" class="mb20">
<el-form-item label="设备" prop="hardId">
<select-hard v-model="form.hardId" :apiParams="{ type: '4' }" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item prop="hardDoorNumber">
<template #label>
<span>放置层数</span>
<tip content="商品在智能柜的层数,按层数放置会提高识别率" />
</template>
<el-input-number :min="0" :step="1" v-model="form.hardDoorNumber" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="商品名" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名" />
@@ -31,6 +17,21 @@
<upload-imgs v-model="form.pic" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="口味" prop="specsTaste">
<el-input v-model="form.specsTaste" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="容量" prop="specsCapacity">
<el-input v-model="form.specsCapacity" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="重量" prop="specsWeight">
<el-input v-model="form.specsWeight" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="单价" prop="price">
<el-input-number :precision="2" :min="0" :step="1" v-model="form.price" placeholder="" />
@@ -79,6 +80,7 @@
</template>
<script setup lang="ts" name="HardSpuDialog">
import { storePrice, displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
import { useMessage } from "/@/hooks/message"
import * as hardSpu from "/@/api/hard/hard-spu"
@@ -97,6 +99,9 @@ const form = reactive({
spuCategoryId: "",
name: "",
pic: "",
specsTaste: "",
specsCapacity: "",
specsWeight: "",
price: 0,
salesCount: 0,
repertoryCount: 0,
@@ -142,7 +147,8 @@ const onSubmit = async () => {
try {
loading.value = true
form.id ? await hardSpu.putObj(form) : await hardSpu.addObj(form)
const _pa = { ...form, price: storePrice(form.price) }
form.id ? await hardSpu.putObj(_pa) : await hardSpu.addObj(_pa)
useMessage().success(form.id ? "修改成功" : "添加成功")
visible.value = false
emit("refresh")
@@ -160,7 +166,7 @@ const gethardSpuData = (id: string) => {
hardSpu
.getObj(id)
.then((res: any) => {
Object.assign(form, res.data)
Object.assign(form, res.data, { price: displayPrice(res.data.price, "", 0) })
})
.finally(() => {
loading.value = false
+16 -16
View File
@@ -37,26 +37,26 @@
</template>
</el-table-column>
<el-table-column prop="categoryName" width="120" label="分类" />
<el-table-column width="150" label="商户">
<template #default="{ row }">
<span>{{ row.merchantName }}</span>
</template>
</el-table-column>
<el-table-column width="150" label="放置层数">
<template #default="{ row }">
<span>{{ row.hardDoorNumber }}层</span>
</template>
</el-table-column>
<el-table-column width="150" label="设备名">
<template #default="{ row }">
<span>{{ row.hardName }}</span>
</template>
</el-table-column>
<el-table-column prop="price" label="单价">
<template #default="{ row }">
<span class="color-success">{{ displayPrice(row.price) }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
<template #default="{ row }">
<dict-tag :options="hard_ks_sku_type" :value="row.skuType" />
</template>
</el-table-column>
<el-table-column prop="price" width="240" label="规格">
<template #default="{ row }">
<span>口味:</span>
<span class="color-primary">{{ row.specsTaste }}</span>
<span>容量:</span>
<span class="color-primary">{{ row.specsCapacity }}</span>
<span>重量:</span>
<span class="color-primary">{{ row.specsWeight }}</span>
</template>
</el-table-column>
<el-table-column prop="salesCount" label="销量">
<template #default="{ row }">
<span class="color-primary">{{ row.salesCount }}</span>
@@ -107,7 +107,7 @@ import { displayPrice } from "/@/utils/formatMoney"
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
// 定义查询字典
const { yes_no_type } = useDict("yes_no_type")
const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_type")
// 定义变量内容
const formDialogRef = ref()
// 搜索变量