feat:旷世商品上架流程

This commit is contained in:
dzc committed 2025-04-25 21:07:50 +08:00
1 parent 93803e7676
commit 2e03233524
4 files changed
+187 -22

No files matched your search

+11
View File
@@ -1,5 +1,16 @@
import request from "/@/utils/request"
/**
* 更新审核进度
*/
export function updateProgress(query: any) {
return request({
url: "/hard/hard-spu/progress",
method: "get",
params: query,
})
}
/**
* 根据设备id智能柜编号查询商品
* @param hardId 设备id
@@ -101,7 +101,9 @@ const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_ty
const queryRef = ref()
const visible = ref(false)
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
queryForm: {
spuCategoryIdIsNotNull: true,
},
pageList: hardSpu.pageJoin,
})
const curCabinetItemId = ref<string>("")
+130
View File
@@ -0,0 +1,130 @@
<template>
<el-dialog title="审核进度" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
<el-form ref="dataFormRef" :model="form" formDialogRef label-width="120px" v-loading="loading">
<el-row :gutter="24">
<el-divider>商品信息</el-divider>
<el-col :span="24" class="mb20">
<el-form-item label="商品名" prop="name">
<el-input v-model="form.name" placeholder="" disabled />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="分类" prop="spuCategoryId">
<select-hard-spu-category v-model="form.spuCategoryId" :apiParams="{ hardId: form.hardId }" disabled />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
<el-form-item label="商品封面图片" prop="cover">
<preview-image :src="form.cover" />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
<el-form-item label="商品识别图片" prop="pic">
<preview-image :src="form.pic" />
</el-form-item>
</el-col>
<el-divider>审核信息</el-divider>
<el-col :span="24" class="mb20">
<el-form-item label="商品名" prop="name">
<el-input v-model="form.name" placeholder="" disabled />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="审核进度" prop="ksStatusTitle">
<el-input v-model="form.ksStatusTitle" placeholder="" disabled />
</el-form-item>
</el-col>
<el-col :span="24" class="mb20">
<el-form-item label="核状态描述" prop="ksComments">
<el-input v-model="form.ksComments" placeholder="" type="textarea" :autosize="{ minRows: 6 }" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button icon="RefreshRight" type="primary" @click="updateProgress">更新进度</el-button>
<el-button @click="visible = false">取消</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="check-progress">
import { storePrice, displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
import { useMessage } from "/@/hooks/message"
import * as hardSpu from "/@/api/hard/hard-spu"
const emit = defineEmits(["refresh"])
// 定义变量内容
const dataFormRef = ref()
const visible = ref(false)
const loading = ref(false)
// 定义字典
const { yes_no_type } = useDict("yes_no_type")
// 提交表单数据
const form = reactive<any>({
id: "",
hardId: "",
spuCategoryId: "",
name: "",
cover: "",
pic: "",
specsTaste: "",
specsCapacity: "",
specsWeight: "",
price: 0,
salesCount: 0,
repertoryCount: 0,
sort: 0,
hardDoorNumber: 1,
status: "1",
isDefault: "0",
})
// 打开弹窗
const openDialog = (id: string) => {
visible.value = true
form.id = ""
// 重置表单数据
nextTick(() => {
dataFormRef.value?.resetFields()
})
// 获取hardSpu信息
if (id) {
form.id = id
gethardSpuData(id)
}
}
// 更新进度
const updateProgress = async () => {
try {
await hardSpu.updateProgress({ id: form.id })
gethardSpuData(form.id)
useMessage().success("更新成功")
} catch (error: any) {
useMessage().error(error.msg)
}
}
// 初始化表单数据
const gethardSpuData = (id: string) => {
// 获取数据
loading.value = true
hardSpu
.getObj(id)
.then((res: any) => {
Object.assign(form, res.data, { price: Number(displayPrice(res.data.price, "", 0)) })
})
.finally(() => {
loading.value = false
})
}
// 暴露变量
defineExpose({
openDialog,
})
</script>
+43 -21
View File
@@ -67,12 +67,20 @@
</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>
<div class="flex">
<div v-if="row.specsTaste">
<span>口味:</span>
<span class="color-primary">{{ row.specsTaste }}</span>
</div>
<div v-if="row.specsCapacity">
<span>容量:</span>
<span class="color-primary">{{ row.specsCapacity }}</span>
</div>
<div v-if="row.specsWeight">
<span>重量:</span>
<span class="color-primary">{{ row.specsWeight }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="salesCount" label="销量">
@@ -96,29 +104,41 @@
<dict-tag :options="yes_no_type" :value="row.isDefault" />
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<el-table-column label="操作" fixed="right" width="250">
<template #default="{ row }">
<el-button icon="edit-pen" text type="primary" v-auth="'hard_hardSpu_edit'" @click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button
v-if="!(row.skuType == '0')"
icon="delete"
text
type="primary"
v-auth="'hard_hardSpu_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
<div class="flex">
<el-button icon="edit-pen" text type="primary" v-auth="'hard_hardSpu_edit'" @click="formDialogRef.openDialog(row.id)">
编辑
</el-button>
<el-button
v-if="row.skuType != '0'"
icon="CircleCheck"
text
type="primary"
v-auth="'hard_hardSpu_edit'"
@click="checkProgRessRef.openDialog(row.id)"
>
审核进度
</el-button>
<el-button
v-if="row.skuType != '0'"
icon="delete"
text
type="primary"
v-auth="'hard_hardSpu_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<check-progRess ref="checkProgRessRef" />
</div>
</template>
@@ -131,10 +151,12 @@ import { displayPrice } from "/@/utils/formatMoney"
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
const CheckProgRess = defineAsyncComponent(() => import("./check-progress.vue"))
// 定义查询字典
const { yes_no_type, hard_ks_sku_type } = useDict("yes_no_type", "hard_ks_sku_type")
// 定义变量内容
const formDialogRef = ref()
const checkProgRessRef = ref()
// 搜索变量
const queryRef = ref()
const showSearch = ref(true)