mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 01:18:54 +08:00
refactor(goods-setting): 移除图片尺寸配置并新增自营店商品审核开关
- 移除缩略图、小图、原图宽高配置项及相关校验规则 - 新增自营店商品审核独立开关(selfOperatedGoodsCheck) - 统一商品审核开关值为字符串类型 true/false - 更新商品审核描述文案为非自营店商品审核说明 - 清理README中已移除功能的描述条目
This commit is contained in:
@@ -98,23 +98,11 @@
|
||||
<el-radio-button value="CLOSE">关闭</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品页面小图宽度" prop="smallPictureWidth">
|
||||
<el-input v-model="goods.smallPictureWidth" placeholder="商品页面小图宽度" style="width: 350px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品页面小图高度" prop="smallPictureHeight">
|
||||
<el-input v-model="goods.smallPictureHeight" placeholder="商品页面小图高度" style="width: 350px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="缩略图宽度" prop="abbreviationPictureWidth">
|
||||
<el-input v-model="goods.abbreviationPictureWidth" placeholder="缩略图宽度" style="width: 350px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="缩略图高度" prop="abbreviationPictureHeight">
|
||||
<el-input v-model="goods.abbreviationPictureHeight" placeholder="缩略图高度" style="width: 350px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原图宽" prop="originalPictureWidth">
|
||||
<el-input v-model="goods.originalPictureWidth" placeholder="原图宽" style="width: 350px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原图高" prop="originalPictureHeight">
|
||||
<el-input v-model="goods.originalPictureHeight" placeholder="原图高" style="width: 350px" />
|
||||
<el-form-item label="自营店商品审核" prop="selfOperatedGoodsCheck">
|
||||
<el-radio-group v-model="goods.selfOperatedGoodsCheck">
|
||||
<el-radio-button value="OPEN">需要审核</el-radio-button>
|
||||
<el-radio-button value="CLOSE">无需审核</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" style="width: 100px;margin-right:5px" :loading="saveLoading" @click="saveGoods">
|
||||
@@ -162,12 +150,7 @@ const order = ref({
|
||||
});
|
||||
const goods = ref({
|
||||
goodsCheck: "OPEN",
|
||||
smallPictureWidth: "",
|
||||
smallPictureHeight: "",
|
||||
abbreviationPictureWidth: "",
|
||||
abbreviationPictureHeight: "",
|
||||
originalPictureWidth: "",
|
||||
originalPictureHeight: "",
|
||||
selfOperatedGoodsCheck: "OPEN",
|
||||
});
|
||||
// 历史遗留:wechat/qq/weibo/alipay 未在 data 中声明,直接挂 this,且模板中无对应表单项
|
||||
let wechat;
|
||||
@@ -262,86 +245,7 @@ const orderValidate = {
|
||||
},
|
||||
],
|
||||
};
|
||||
const goodsValidate = {
|
||||
smallPictureWidth: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
smallPictureHeight: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
abbreviationPictureWidth: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
abbreviationPictureHeight: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
originalPictureWidth: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
originalPictureHeight: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (!regular.integer.test(value)) {
|
||||
callback(new Error("请输入正整数,且不为零!"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
};
|
||||
const goodsValidate = {};
|
||||
|
||||
const baseForm = ref(null);
|
||||
const pointForm = ref(null);
|
||||
@@ -401,7 +305,10 @@ function initGoods() {
|
||||
if (res.success) {
|
||||
loading.value = false;
|
||||
if (res.result) {
|
||||
goods.value = res.result;
|
||||
goods.value = {
|
||||
goodsCheck: res.result.goodsCheck,
|
||||
selfOperatedGoodsCheck: res.result.selfOperatedGoodsCheck ?? res.result.goodsCheck,
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,50 +6,15 @@
|
||||
<el-radio-button value="true">开启</el-radio-button>
|
||||
<el-radio-button value="false">关闭</el-radio-button>
|
||||
</el-radio-group>
|
||||
<span class="desc">商品审核关闭后,商家添加商品则无需审核直接上架</span>
|
||||
<span class="desc">控制非自营店商品是否需要审核</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="自营店商品审核" prop="selfOperatedGoodsCheck">
|
||||
<el-radio-group v-model="formValidate.selfOperatedGoodsCheck">
|
||||
<el-radio-button value="true">需要审核</el-radio-button>
|
||||
<el-radio-button value="false">无需审核</el-radio-button>
|
||||
</el-radio-group>
|
||||
<span class="desc">独立控制自营店新增、编辑商品是否需要审核</span>
|
||||
</el-form-item>
|
||||
<div class="label-item">
|
||||
<el-form-item class="label-item" label="缩略图宽" prop="abbreviationPictureWidth">
|
||||
<el-input type="number" v-model="formValidate.abbreviationPictureWidth">
|
||||
<template #prepend>宽</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item class="label-item" label="缩略图高" prop="abbreviationPictureHeight">
|
||||
<el-input type="number" v-model="formValidate.abbreviationPictureHeight">
|
||||
<template #prepend>高</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="label-item">
|
||||
<el-form-item label="小图宽" prop="smallPictureWidth">
|
||||
<el-input type="number" v-model="formValidate.smallPictureWidth">
|
||||
<template #prepend>宽</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="小图高" class="label-item" prop="smallPictureHeight">
|
||||
<el-input type="number" v-model="formValidate.smallPictureHeight">
|
||||
<template #prepend>高</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="label-item">
|
||||
<el-form-item class="label-item" label="原图宽高" prop="originalPictureWidth">
|
||||
<el-input type="number" v-model="formValidate.originalPictureWidth">
|
||||
<template #prepend>宽</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item class="label-item" label="原图宽高" prop="originalPictureHeight">
|
||||
<el-input type="number" v-model="formValidate.originalPictureHeight">
|
||||
<template #prepend>高</template>
|
||||
<template #append>px</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="label-btns goods-setting-btns">
|
||||
<div class="goods-setting-save-row">
|
||||
<el-button type="primary" @click="submit('formValidate')">保存</el-button>
|
||||
@@ -67,13 +32,8 @@ const props = defineProps(["res", "type"]);
|
||||
|
||||
// 表单数据(init 中整体替换)
|
||||
const formValidate = ref({
|
||||
goodsCheck: 1,
|
||||
smallPictureHeight: "0",
|
||||
smallPictureWidth: "0",
|
||||
abbreviationPictureWidth: "0",
|
||||
abbreviationPictureHeight: "0",
|
||||
originalPictureWidth: "0",
|
||||
originalPictureHeight: "0",
|
||||
goodsCheck: "false",
|
||||
selfOperatedGoodsCheck: "false",
|
||||
});
|
||||
// 校验规则(只做属性合并)
|
||||
const ruleValidate = reactive({});
|
||||
@@ -104,10 +64,11 @@ function setupSetting() {
|
||||
}
|
||||
function init() {
|
||||
result.value = JSON.parse(props.res);
|
||||
Object.keys(result.value).map((item) => {
|
||||
result.value[item] += "";
|
||||
});
|
||||
formValidate.value = { ...result.value };
|
||||
const toBooleanText = (value) => String(value === true || value === "true");
|
||||
formValidate.value = {
|
||||
goodsCheck: toBooleanText(result.value.goodsCheck),
|
||||
selfOperatedGoodsCheck: toBooleanText(result.value.selfOperatedGoodsCheck ?? result.value.goodsCheck),
|
||||
};
|
||||
Object.keys(formValidate.value).forEach((item) => {
|
||||
ruleValidate[item] = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user