[积分商城]优化页面样式
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
:label-width="baTable.form.labelWidth + 'px'"
|
:label-width="baTable.form.labelWidth + 'px'"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
>
|
>
|
||||||
|
<!-- 先选类型:未选类型时只显示标题与类型,避免看到无关字段 -->
|
||||||
<FormItem
|
<FormItem
|
||||||
:label="t('mall.item.title')"
|
:label="t('mall.item.title')"
|
||||||
type="string"
|
type="string"
|
||||||
@@ -36,34 +37,6 @@
|
|||||||
prop="title"
|
prop="title"
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.title') })"
|
:placeholder="t('Please input field', { field: t('mall.item.title') })"
|
||||||
/>
|
/>
|
||||||
<FormItem
|
|
||||||
:label="t('mall.item.description')"
|
|
||||||
type="textarea"
|
|
||||||
v-model="baTable.form.items!.description"
|
|
||||||
prop="description"
|
|
||||||
:input-attr="{ rows: 3 }"
|
|
||||||
@keyup.enter.stop=""
|
|
||||||
@keyup.ctrl.enter="baTable.onSubmit(formRef)"
|
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.description') })"
|
|
||||||
/>
|
|
||||||
<FormItem
|
|
||||||
:label="t('mall.item.remark')"
|
|
||||||
type="textarea"
|
|
||||||
v-model="baTable.form.items!.remark"
|
|
||||||
prop="remark"
|
|
||||||
:input-attr="{ rows: 3 }"
|
|
||||||
@keyup.enter.stop=""
|
|
||||||
@keyup.ctrl.enter="baTable.onSubmit(formRef)"
|
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.remark') })"
|
|
||||||
/>
|
|
||||||
<FormItem
|
|
||||||
:label="t('mall.item.score')"
|
|
||||||
type="number"
|
|
||||||
v-model="baTable.form.items!.score"
|
|
||||||
prop="score"
|
|
||||||
:input-attr="{ step: 1 }"
|
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.score') })"
|
|
||||||
/>
|
|
||||||
<FormItem
|
<FormItem
|
||||||
:label="t('mall.item.type')"
|
:label="t('mall.item.type')"
|
||||||
type="select"
|
type="select"
|
||||||
@@ -72,65 +45,101 @@
|
|||||||
:input-attr="{ content: { '1': t('mall.item.type 1'), '2': t('mall.item.type 2'), '3': t('mall.item.type 3') } }"
|
:input-attr="{ content: { '1': t('mall.item.type 1'), '2': t('mall.item.type 2'), '3': t('mall.item.type 3') } }"
|
||||||
:placeholder="t('Please select field', { field: t('mall.item.type') })"
|
:placeholder="t('Please select field', { field: t('mall.item.type') })"
|
||||||
/>
|
/>
|
||||||
<FormItem
|
|
||||||
:label="t('mall.item.amount')"
|
<template v-if="hasItemType">
|
||||||
type="number"
|
<FormItem
|
||||||
v-model="baTable.form.items!.amount"
|
:label="t('mall.item.description')"
|
||||||
prop="amount"
|
type="textarea"
|
||||||
:input-attr="{ step: 0.01 }"
|
v-model="baTable.form.items!.description"
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.amount') })"
|
prop="description"
|
||||||
v-if="isBonusOrWithdraw"
|
:input-attr="{ rows: 3 }"
|
||||||
/>
|
@keyup.enter.stop=""
|
||||||
<FormItem
|
@keyup.ctrl.enter="baTable.onSubmit(formRef)"
|
||||||
:label="t('mall.item.multiplier')"
|
:placeholder="t('Please input field', { field: t('mall.item.description') })"
|
||||||
type="number"
|
/>
|
||||||
v-model="baTable.form.items!.multiplier"
|
<FormItem
|
||||||
prop="multiplier"
|
:label="t('mall.item.score')"
|
||||||
:input-attr="{ step: 1 }"
|
type="number"
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.multiplier') })"
|
v-model="baTable.form.items!.score"
|
||||||
v-if="isBonusOrWithdraw"
|
prop="score"
|
||||||
/>
|
:input-attr="{ step: 1 }"
|
||||||
<FormItem
|
:placeholder="t('Please input field', { field: t('mall.item.score') })"
|
||||||
:label="t('mall.item.category')"
|
/>
|
||||||
type="string"
|
|
||||||
v-model="baTable.form.items!.category"
|
<!-- BONUS / WITHDRAW:现金面值、流水倍数 -->
|
||||||
prop="category"
|
<FormItem
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.category') })"
|
v-if="isBonusOrWithdraw"
|
||||||
v-if="isBonusOrWithdraw"
|
:label="t('mall.item.amount')"
|
||||||
/>
|
type="number"
|
||||||
<FormItem
|
v-model="baTable.form.items!.amount"
|
||||||
:label="t('mall.item.category_title')"
|
prop="amount"
|
||||||
type="string"
|
:input-attr="{ step: 0.01 }"
|
||||||
v-model="baTable.form.items!.category_title"
|
:placeholder="t('Please input field', { field: t('mall.item.amount') })"
|
||||||
prop="category_title"
|
/>
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.category_title') })"
|
<FormItem
|
||||||
v-if="isBonusOrWithdraw"
|
v-if="isBonusOrWithdraw"
|
||||||
/>
|
:label="t('mall.item.multiplier')"
|
||||||
<FormItem :label="t('mall.item.image')" type="image" v-model="baTable.form.items!.image" />
|
type="number"
|
||||||
<FormItem
|
v-model="baTable.form.items!.multiplier"
|
||||||
:label="t('mall.item.stock')"
|
prop="multiplier"
|
||||||
type="number"
|
:input-attr="{ step: 1 }"
|
||||||
v-model="baTable.form.items!.stock"
|
:placeholder="t('Please input field', { field: t('mall.item.multiplier') })"
|
||||||
prop="stock"
|
/>
|
||||||
:input-attr="{ step: 1 }"
|
<!-- 仅 BONUS:Bonus Grant 需要 -->
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.stock') })"
|
<FormItem
|
||||||
v-if="isPhysical"
|
v-if="isBonus"
|
||||||
/>
|
:label="t('mall.item.category')"
|
||||||
<FormItem
|
type="string"
|
||||||
:label="t('mall.item.sort')"
|
v-model="baTable.form.items!.category"
|
||||||
type="number"
|
prop="category"
|
||||||
v-model="baTable.form.items!.sort"
|
:placeholder="t('Please input field', { field: t('mall.item.category') })"
|
||||||
prop="sort"
|
/>
|
||||||
:input-attr="{ step: 1 }"
|
<FormItem
|
||||||
:placeholder="t('Please input field', { field: t('mall.item.sort') })"
|
v-if="isBonus"
|
||||||
/>
|
:label="t('mall.item.category_title')"
|
||||||
<FormItem
|
type="string"
|
||||||
:label="t('mall.item.status')"
|
v-model="baTable.form.items!.category_title"
|
||||||
type="switch"
|
prop="category_title"
|
||||||
v-model="baTable.form.items!.status"
|
:placeholder="t('Please input field', { field: t('mall.item.category_title') })"
|
||||||
prop="status"
|
/>
|
||||||
:input-attr="{ content: { '0': t('mall.item.status 0'), '1': t('mall.item.status 1') } }"
|
<!-- 仅 PHYSICAL:库存 -->
|
||||||
/>
|
<FormItem
|
||||||
|
v-if="isPhysical"
|
||||||
|
:label="t('mall.item.stock')"
|
||||||
|
type="number"
|
||||||
|
v-model="baTable.form.items!.stock"
|
||||||
|
prop="stock"
|
||||||
|
:input-attr="{ step: 1 }"
|
||||||
|
:placeholder="t('Please input field', { field: t('mall.item.stock') })"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
:label="t('mall.item.remark')"
|
||||||
|
type="textarea"
|
||||||
|
v-model="baTable.form.items!.remark"
|
||||||
|
prop="remark"
|
||||||
|
:input-attr="{ rows: 3 }"
|
||||||
|
@keyup.enter.stop=""
|
||||||
|
@keyup.ctrl.enter="baTable.onSubmit(formRef)"
|
||||||
|
:placeholder="t('Please input field', { field: t('mall.item.remark') })"
|
||||||
|
/>
|
||||||
|
<FormItem :label="t('mall.item.image')" type="image" v-model="baTable.form.items!.image" />
|
||||||
|
<FormItem
|
||||||
|
:label="t('mall.item.sort')"
|
||||||
|
type="number"
|
||||||
|
v-model="baTable.form.items!.sort"
|
||||||
|
prop="sort"
|
||||||
|
:input-attr="{ step: 1 }"
|
||||||
|
:placeholder="t('Please input field', { field: t('mall.item.sort') })"
|
||||||
|
/>
|
||||||
|
<FormItem
|
||||||
|
:label="t('mall.item.status')"
|
||||||
|
type="switch"
|
||||||
|
v-model="baTable.form.items!.status"
|
||||||
|
prop="status"
|
||||||
|
:input-attr="{ content: { '0': t('mall.item.status 0'), '1': t('mall.item.status 1') } }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@@ -166,7 +175,10 @@ const isPhysical = computed(() => itemType.value === 2 || itemType.value === '2'
|
|||||||
const isWithdraw = computed(() => itemType.value === 3 || itemType.value === '3')
|
const isWithdraw = computed(() => itemType.value === 3 || itemType.value === '3')
|
||||||
const isBonusOrWithdraw = computed(() => isBonus.value || isWithdraw.value)
|
const isBonusOrWithdraw = computed(() => isBonus.value || isWithdraw.value)
|
||||||
|
|
||||||
// 切换类型后,清理不适用的字段,避免“隐藏字段仍保留上一次的值”导致提交脏数据
|
/** 已选择商品类型(1/2/3)后,才展示其余表单项 */
|
||||||
|
const hasItemType = computed(() => isBonus.value || isPhysical.value || isWithdraw.value)
|
||||||
|
|
||||||
|
// 切换类型后,清理不适用的字段(严格:WITHDRAW 不保留红利类别字段)
|
||||||
watch(
|
watch(
|
||||||
itemType,
|
itemType,
|
||||||
(n, o) => {
|
(n, o) => {
|
||||||
@@ -176,14 +188,20 @@ watch(
|
|||||||
const typeNum = Number(n)
|
const typeNum = Number(n)
|
||||||
if (!Number.isFinite(typeNum)) return
|
if (!Number.isFinite(typeNum)) return
|
||||||
|
|
||||||
if (typeNum === 2) {
|
if (typeNum === 1) {
|
||||||
|
// BONUS:实物库存不适用
|
||||||
|
baTable.form.items.stock = 0
|
||||||
|
} else if (typeNum === 2) {
|
||||||
|
// PHYSICAL:现金/倍数/类别不适用
|
||||||
baTable.form.items.amount = 0
|
baTable.form.items.amount = 0
|
||||||
baTable.form.items.multiplier = 0
|
baTable.form.items.multiplier = 0
|
||||||
baTable.form.items.category = ''
|
baTable.form.items.category = ''
|
||||||
baTable.form.items.category_title = ''
|
baTable.form.items.category_title = ''
|
||||||
} else {
|
} else if (typeNum === 3) {
|
||||||
// BONUS / WITHDRAW
|
// WITHDRAW:提现接口不使用 category,清空避免误存
|
||||||
baTable.form.items.stock = 0
|
baTable.form.items.stock = 0
|
||||||
|
baTable.form.items.category = ''
|
||||||
|
baTable.form.items.category_title = ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ flush: 'post' },
|
{ flush: 'post' },
|
||||||
@@ -191,10 +209,33 @@ watch(
|
|||||||
|
|
||||||
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||||
title: [buildValidatorData({ name: 'required', title: t('mall.item.title') })],
|
title: [buildValidatorData({ name: 'required', title: t('mall.item.title') })],
|
||||||
description: [buildValidatorData({ name: 'required', title: t('mall.item.description') })],
|
description: [
|
||||||
|
{
|
||||||
|
validator: (rule: any, val: any, callback: Function) => {
|
||||||
|
if (!hasItemType.value) return callback()
|
||||||
|
if (val === '' || val === null || val === undefined) {
|
||||||
|
return callback(new Error(t('Please input field', { field: t('mall.item.description') })))
|
||||||
|
}
|
||||||
|
return callback()
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
score: [
|
score: [
|
||||||
buildValidatorData({ name: 'number', title: t('mall.item.score') }),
|
{
|
||||||
buildValidatorData({ name: 'required', title: t('mall.item.score') }),
|
validator: (rule: any, val: any, callback: Function) => {
|
||||||
|
if (!hasItemType.value) return callback()
|
||||||
|
if (val === '' || val === null || val === undefined) {
|
||||||
|
return callback(new Error(t('Please input field', { field: t('mall.item.score') })))
|
||||||
|
}
|
||||||
|
const num = Number(val)
|
||||||
|
if (!Number.isFinite(num)) {
|
||||||
|
return callback(new Error(t('Please enter the correct field', { field: t('mall.item.score') })))
|
||||||
|
}
|
||||||
|
return callback()
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
type: [buildValidatorData({ name: 'required', title: t('mall.item.type') })],
|
type: [buildValidatorData({ name: 'required', title: t('mall.item.type') })],
|
||||||
amount: [
|
amount: [
|
||||||
@@ -238,7 +279,7 @@ const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
|||||||
category: [
|
category: [
|
||||||
{
|
{
|
||||||
validator: (rule: any, val: any, callback: Function) => {
|
validator: (rule: any, val: any, callback: Function) => {
|
||||||
if (!isBonusOrWithdraw.value) return callback()
|
if (!isBonus.value) return callback()
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return callback(new Error(t('Please input field', { field: t('mall.item.category') })))
|
return callback(new Error(t('Please input field', { field: t('mall.item.category') })))
|
||||||
}
|
}
|
||||||
@@ -250,7 +291,7 @@ const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
|||||||
category_title: [
|
category_title: [
|
||||||
{
|
{
|
||||||
validator: (rule: any, val: any, callback: Function) => {
|
validator: (rule: any, val: any, callback: Function) => {
|
||||||
if (!isBonusOrWithdraw.value) return callback()
|
if (!isBonus.value) return callback()
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return callback(new Error(t('Please input field', { field: t('mall.item.category_title') })))
|
return callback(new Error(t('Please input field', { field: t('mall.item.category_title') })))
|
||||||
}
|
}
|
||||||
|
|||||||
1
web/types/tableRenderer.d.ts
vendored
1
web/types/tableRenderer.d.ts
vendored
@@ -4,6 +4,7 @@ type TableRenderer =
|
|||||||
| 'color'
|
| 'color'
|
||||||
| 'customRender'
|
| 'customRender'
|
||||||
| 'customTemplate'
|
| 'customTemplate'
|
||||||
|
| 'date'
|
||||||
| 'datetime'
|
| 'datetime'
|
||||||
| 'icon'
|
| 'icon'
|
||||||
| 'image'
|
| 'image'
|
||||||
|
|||||||
Reference in New Issue
Block a user