diff --git a/src/views/mall/product/brand/index.vue b/src/views/mall/product/brand/index.vue index fab7a2ded..23d9abc93 100644 --- a/src/views/mall/product/brand/index.vue +++ b/src/views/mall/product/brand/index.vue @@ -59,7 +59,7 @@ diff --git a/src/views/mall/product/category/index.vue b/src/views/mall/product/category/index.vue index ebe1d63f6..3bd232e79 100644 --- a/src/views/mall/product/category/index.vue +++ b/src/views/mall/product/category/index.vue @@ -38,7 +38,7 @@ diff --git a/src/views/mall/product/comment/index.vue b/src/views/mall/product/comment/index.vue index 1b0745ba5..7c0737f57 100644 --- a/src/views/mall/product/comment/index.vue +++ b/src/views/mall/product/comment/index.vue @@ -115,7 +115,7 @@ :formatter="dateFormatter" width="170" /> - + @@ -185,11 +175,7 @@ import { propTypes } from '@/utils/propTypes' import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree' import { createImageViewer } from '@/components/ImageViewer' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' -import { - PropertyAndValues, - RuleConfig, - SkuList -} from '@/views/mall/product/spu/components/index.ts' +import { getPropertyList, SkuList } from '@/views/mall/product/spu/components/index.ts' import ProductAttributes from './ProductAttributes.vue' import ProductPropertyAddForm from './ProductPropertyAddForm.vue' import { basicInfoSchema } from './spu.data' @@ -200,30 +186,6 @@ import * as ExpressTemplateApi from '@/api/mall/trade/delivery/expressTemplate' defineOptions({ name: 'ProductSpuBasicInfoForm' }) -// sku 相关属性校验规则 -const ruleConfig: RuleConfig[] = [ - { - name: 'stock', - rule: (arg) => arg >= 1, - message: '商品库存必须大于等于 1 !!!' - }, - { - name: 'price', - rule: (arg) => arg >= 0.01, - message: '商品销售价格必须大于等于 0.01 !!!' - }, - { - name: 'marketPrice', - rule: (arg) => arg >= 0.01, - message: '商品市场价格必须大于等于 0.01 !!!' - }, - { - name: 'costPrice', - rule: (arg) => arg >= 0.01, - message: '商品成本价格必须大于等于 0.01 !!!' - } -] - // ====== 商品详情相关操作 ====== const { allSchemas } = useCrudSchemas(basicInfoSchema) /** 商品图预览 */ @@ -241,34 +203,6 @@ const imagePreview = (args) => { }) } -/** - * 获得商品的规格列表 - * - * @param spu - * @return PropertyAndValues 规格列表 - */ -const getPropertyList = (spu: Spu): PropertyAndValues[] => { - // 直接拿返回的 skus 属性逆向生成出 propertyList - const properties: PropertyAndValues[] = [] - // 只有是多规格才处理 - if (spu.specType) { - spu.skus?.forEach((sku) => { - sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => { - // 添加属性 - if (!properties?.some((item) => item.id === propertyId)) { - properties.push({ id: propertyId!, name: propertyName!, values: [] }) - } - // 添加属性值 - const index = properties?.findIndex((item) => item.id === propertyId) - if (!properties[index].values?.some((value) => value.id === valueId)) { - properties[index].values?.push({ id: valueId!, name: valueName! }) - } - }) - }) - } - return properties -} - // ====== end ====== const message = useMessage() // 消息弹窗 diff --git a/src/views/mall/product/spu/form/index.vue b/src/views/mall/product/spu/form/index.vue index 526bb338f..1b5654cfa 100644 --- a/src/views/mall/product/spu/form/index.vue +++ b/src/views/mall/product/spu/form/index.vue @@ -189,7 +189,7 @@ const submitForm = async () => { /** 关闭按钮 */ const close = () => { delView(unref(currentRoute)) - push('/product/product-spu') + push({ name: 'ProductSpu' }) } /** 初始化 */ onMounted(async () => { diff --git a/src/views/mall/product/spu/index.vue b/src/views/mall/product/spu/index.vue index 9ea06cd59..2ed6d3ada 100644 --- a/src/views/mall/product/spu/index.vue +++ b/src/views/mall/product/spu/index.vue @@ -170,6 +170,14 @@ > 详情 + + 修改 +