Merge remote-tracking branch 'origin/main' into pro
Deploy olons-admin production / deploy (push) Successful in 5m17s
Deploy olons-admin production / deploy (push) Successful in 5m17s
This commit is contained in:
@@ -55,6 +55,24 @@ func (s *sSysProduct) List(ctx context.Context, in *sysin.ProductListInp) (list
|
|||||||
if in.CategoryId > 0 {
|
if in.CategoryId > 0 {
|
||||||
mod = mod.Where(col("p", pc.CategoryId), in.CategoryId)
|
mod = mod.Where(col("p", pc.CategoryId), in.CategoryId)
|
||||||
}
|
}
|
||||||
|
var minAmount, maxAmount int64
|
||||||
|
if in.PriceMin != "" {
|
||||||
|
minAmount, err = parseCents(in.PriceMin)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, gerror.New("最低价格格式不正确")
|
||||||
|
}
|
||||||
|
mod = mod.WhereGTE(col("p", pc.PriceAmount), minAmount)
|
||||||
|
}
|
||||||
|
if in.PriceMax != "" {
|
||||||
|
maxAmount, err = parseCents(in.PriceMax)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, gerror.New("最高价格格式不正确")
|
||||||
|
}
|
||||||
|
mod = mod.WhereLTE(col("p", pc.PriceAmount), maxAmount)
|
||||||
|
}
|
||||||
|
if in.PriceMin != "" && in.PriceMax != "" && minAmount > maxAmount {
|
||||||
|
return nil, 0, gerror.New("最低价格不能高于最高价格")
|
||||||
|
}
|
||||||
if in.PublishStatus > 0 {
|
if in.PublishStatus > 0 {
|
||||||
mod = mod.Where(col("p", pc.PublishStatus), in.PublishStatus)
|
mod = mod.Where(col("p", pc.PublishStatus), in.PublishStatus)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ type ProductListInp struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
PaymentType string `json:"paymentType"`
|
PaymentType string `json:"paymentType"`
|
||||||
CategoryId uint64 `json:"categoryId"`
|
CategoryId uint64 `json:"categoryId"`
|
||||||
|
PriceMin string `json:"priceMin" dc:"最低价格"`
|
||||||
|
PriceMax string `json:"priceMax" dc:"最高价格"`
|
||||||
PublishStatus int `json:"publishStatus"`
|
PublishStatus int `json:"publishStatus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<n-card :bordered="false" class="proCard">
|
<n-card :bordered="false" class="proCard">
|
||||||
<BasicForm ref="searchRef" @register="register" @submit="reload" @keyup.enter="reload" />
|
<BasicForm ref="searchRef" @register="register" @submit="reload" @keyup.enter="reload">
|
||||||
|
<template #priceRangeSlot="{ model }">
|
||||||
|
<n-space :wrap="false" align="center">
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="model.priceMin"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:show-button="false"
|
||||||
|
clearable
|
||||||
|
placeholder="最低价"
|
||||||
|
/>
|
||||||
|
<span>-</span>
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="model.priceMax"
|
||||||
|
:min="0"
|
||||||
|
:precision="2"
|
||||||
|
:show-button="false"
|
||||||
|
clearable
|
||||||
|
placeholder="最高价"
|
||||||
|
/>
|
||||||
|
</n-space>
|
||||||
|
</template>
|
||||||
|
</BasicForm>
|
||||||
<BasicTable
|
<BasicTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
openChecked
|
openChecked
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { computed, h, ref } from 'vue';
|
import { h, ref } from 'vue';
|
||||||
import { NImage, NTag } from 'naive-ui';
|
import { NImage, NTag } from 'naive-ui';
|
||||||
import { FormSchema } from '@/components/Form';
|
import { FormSchema } from '@/components/Form';
|
||||||
import { useDictStore } from '@/store/modules/dict';
|
import { useDictStore } from '@/store/modules/dict';
|
||||||
@@ -13,14 +13,9 @@ export const schemas = ref<FormSchema[]>([
|
|||||||
componentProps: { clearable: true },
|
componentProps: { clearable: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'categoryId',
|
field: 'priceRange',
|
||||||
component: 'NSelect',
|
label: '价格范围',
|
||||||
label: '商品分类',
|
slot: 'priceRangeSlot',
|
||||||
componentProps: {
|
|
||||||
options: computed(() => dict.getOptionUnRef('productCategoryOption')),
|
|
||||||
clearable: true,
|
|
||||||
placeholder: '请选择',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -62,4 +57,4 @@ export const columns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const loadOptions = () => dict.loadOptions(['productCategoryOption', 'bizPublishStatus']);
|
export const loadOptions = () => dict.loadOptions(['bizPublishStatus']);
|
||||||
|
|||||||
Reference in New Issue
Block a user