mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	fix: 修复 spu 详情查看错误,同步 mall seckill 组件 name 配置方式
This commit is contained in:
		@@ -55,9 +55,9 @@ const { delView } = useTagsViewStore() // 视图操作
 | 
			
		||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
 | 
			
		||||
const activeName = ref('basicInfo') // Tag 激活的窗口
 | 
			
		||||
const isDetail = ref(false) // 是否查看详情
 | 
			
		||||
const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>() // 商品信息Ref
 | 
			
		||||
const descriptionRef = ref<ComponentRef<typeof DescriptionForm>>() // 商品详情Ref
 | 
			
		||||
const otherSettingsRef = ref<ComponentRef<typeof OtherSettingsForm>>() // 其他设置Ref
 | 
			
		||||
const basicInfoRef = ref() // 商品信息Ref
 | 
			
		||||
const descriptionRef = ref() // 商品详情Ref
 | 
			
		||||
const otherSettingsRef = ref() // 其他设置Ref
 | 
			
		||||
// spu 表单数据
 | 
			
		||||
const formData = ref<ProductSpuApi.Spu>({
 | 
			
		||||
  name: '', // 商品名称
 | 
			
		||||
@@ -98,7 +98,7 @@ const formData = ref<ProductSpuApi.Spu>({
 | 
			
		||||
 | 
			
		||||
/** 获得详情 */
 | 
			
		||||
const getDetail = async () => {
 | 
			
		||||
  if ('productSpuDetail' === name) {
 | 
			
		||||
  if ('ProductSpuDetail' === name) {
 | 
			
		||||
    isDetail.value = true
 | 
			
		||||
  }
 | 
			
		||||
  const id = params.spuId as number
 | 
			
		||||
 
 | 
			
		||||
@@ -176,7 +176,7 @@ import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/uti
 | 
			
		||||
import { createImageViewer } from '@/components/ImageViewer'
 | 
			
		||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 | 
			
		||||
import { UploadImg, UploadImgs } from '@/components/UploadFile'
 | 
			
		||||
import { ProductAttributes, ProductPropertyAddForm, SkuList } from './index'
 | 
			
		||||
import { getPropertyList, ProductAttributes, ProductPropertyAddForm, SkuList } from './index'
 | 
			
		||||
import { basicInfoSchema } from './spu.data'
 | 
			
		||||
import type { Spu } from '@/api/mall/product/spu'
 | 
			
		||||
import * as ProductCategoryApi from '@/api/mall/product/category'
 | 
			
		||||
@@ -242,7 +242,7 @@ const rules = reactive({
 | 
			
		||||
  introduction: [required],
 | 
			
		||||
  picUrl: [required],
 | 
			
		||||
  sliderPicUrls: [required],
 | 
			
		||||
  // deliveryTemplateId: [required],
 | 
			
		||||
  deliveryTemplateId: [required],
 | 
			
		||||
  brandId: [required],
 | 
			
		||||
  specType: [required],
 | 
			
		||||
  subCommissionType: [required]
 | 
			
		||||
@@ -261,26 +261,7 @@ watch(
 | 
			
		||||
    formData.sliderPicUrls = data['sliderPicUrls']?.map((item) => ({
 | 
			
		||||
      url: item
 | 
			
		||||
    }))
 | 
			
		||||
    // 只有是多规格才处理
 | 
			
		||||
    if (!formData.specType) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    //  直接拿返回的 skus 属性逆向生成出 propertyList
 | 
			
		||||
    const properties = []
 | 
			
		||||
    formData.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 })
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    })
 | 
			
		||||
    propertyList.value = properties
 | 
			
		||||
    propertyList.value = getPropertyList(data)
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    immediate: true
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user