Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b408b960
authored
Mar 31, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix sku编辑bug修复
1 parent
cfe0edab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
341 additions
and
328 deletions
src/views/goods/productManage/components/multipleSpecificationForm.vue
src/views/goods/productManage/components/productForm.vue
src/views/goods/productManage/components/singleSpecificationForm.vue
src/views/goods/productManage/components/sourceMaterial.vue
src/views/goods/productManage/components/multipleSpecificationForm.vue
View file @
b408b96
...
...
@@ -76,12 +76,12 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示编码,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
商品编码
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span>
第三方名称
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
...
...
@@ -90,32 +90,32 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
计价单位
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
采购成本/元
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
质保时间/年
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
运营系数
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
运营成本
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
适用区域
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
...
...
@@ -174,8 +174,7 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示配件性质,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
class=
"col-accessory-type"
<td
class=
"col-accessory-type"
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
配件性质
</span>
...
...
@@ -212,7 +211,7 @@
:title=
"n"
>
{{ n }}
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.type"
class=
"w-150-per w-150-per"
:class=
"{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }"
...
...
@@ -222,7 +221,7 @@
@
blur=
"handleTypeBlur($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.thirdPartyName"
class=
"w-150-per"
maxlength=
"50"
...
...
@@ -238,7 +237,7 @@
size=
"small"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-select
v-model=
"row.item.priceUnitType"
class=
"w-150-per"
:class=
"{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }"
...
...
@@ -251,7 +250,7 @@
:value=
"opt.value"
/>
</el-select>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.purchaseCost"
class=
"w-150-per"
:class=
"{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }"
...
...
@@ -261,7 +260,7 @@
@
input=
"handlePurchaseCostInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.warrantyPeriod"
class=
"w-150-per"
:class=
"{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }"
...
...
@@ -271,7 +270,7 @@
@
input=
"handleWarrantyPeriodInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.operationCoefficient"
class=
"w-150-per"
:class=
"{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }"
...
...
@@ -281,7 +280,7 @@
@
input=
"handleOperationCoefficientInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.operationCost"
class=
"w-150-per"
:class=
"{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }"
...
...
@@ -291,7 +290,7 @@
@
input=
"handleOperationCostInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.applicableArea"
class=
"w-150-per"
:class=
"{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }"
...
...
@@ -460,8 +459,7 @@
<el-switch
v-model=
"row.item.entityCardFlag"
>
</el-switch>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
class=
"col-accessory-type"
>
<td
class=
"col-accessory-type"
>
<span
class=
"sku-accessory-type"
>
{{ formatAccessoryType(row.item.accessoryType) }}
</span>
</td>
<td
style=
"width: 60px;"
>
...
...
src/views/goods/productManage/components/productForm.vue
View file @
b408b96
This diff could not be displayed because it is too large.
src/views/goods/productManage/components/singleSpecificationForm.vue
View file @
b408b96
...
...
@@ -23,13 +23,13 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示商品编码,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
商品编码
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示第三方名称 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span>
第三方名称
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
...
...
@@ -38,32 +38,32 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
计价单位
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
采购成本/元
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
质保时间/年
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
运营系数
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
运营成本
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
style=
"position: relative;"
>
<td
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType && goodsInfoData.accessoryType !== 1"
class=
"color-red"
>
*
</span>
<span>
适用区域
</span>
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
...
...
@@ -125,8 +125,7 @@
<div
class=
"resize-handle"
@
mousedown=
"onResizeStart"
></div>
</td>
<!-- 轻改/延保展示配件性质,延保不必填 -->
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
class=
"col-accessory-type"
<td
class=
"col-accessory-type"
style=
"position: relative;"
>
<span
v-if=
"!isEquityOrExtendType"
class=
"color-red"
>
*
</span>
<span>
配件性质
</span>
...
...
@@ -192,7 +191,7 @@
</template>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.type"
class=
"w-150-per w-150-per"
:class=
"{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }"
...
...
@@ -203,7 +202,7 @@
@
input=
"handleTypeInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.thirdPartyName"
class=
"w-150-per"
maxlength=
"50"
...
...
@@ -219,7 +218,7 @@
size=
"small"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-select
v-model=
"row.item.priceUnitType"
class=
"w-150-per"
:class=
"{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }"
...
...
@@ -232,7 +231,7 @@
:value=
"opt.value"
/>
</el-select>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.purchaseCost"
class=
"w-150-per"
:class=
"{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }"
...
...
@@ -242,7 +241,7 @@
@
input=
"handlePurchaseCostInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.warrantyPeriod"
class=
"w-150-per"
:class=
"{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }"
...
...
@@ -252,7 +251,7 @@
@
input=
"handleWarrantyPeriodInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.operationCoefficient"
class=
"w-150-per"
:class=
"{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }"
...
...
@@ -262,7 +261,7 @@
@
input=
"handleOperationCoefficientInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model=
"row.item.operationCost"
class=
"w-150-per"
:class=
"{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }"
...
...
@@ -272,7 +271,7 @@
@
input=
"handleOperationCostInput($event, row.originalIndex)"
>
</el-input>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
>
<td>
<el-input
v-model
.
trim=
"row.item.applicableArea"
class=
"w-150-per"
:class=
"{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }"
...
...
@@ -433,8 +432,7 @@
<el-switch
v-model=
"row.item.entityCardFlag"
>
</el-switch>
</td>
<td
v-if=
"!equitySceneType.includes(goodsInfoData.goodsType)"
class=
"col-accessory-type"
>
<td
class=
"col-accessory-type"
>
<span
class=
"sku-accessory-type"
>
{{ formatAccessoryType(row.item.accessoryType) }}
</span>
</td>
<td
style=
"width: 60px;"
>
...
...
src/views/goods/productManage/components/sourceMaterial.vue
View file @
b408b96
<
template
>
<div
class=
"sourceMaterial-form"
id=
"sourceMaterial-form"
>
<div
class=
"title"
>
产品系列-SPU
</div>
<productForm
v-if=
"show"
ref=
"d2GoodsProductForm"
:add-or-edit=
"addOrEdit"
form-name=
"product"
:origin-data=
"editData"
:form-list=
"editForm"
:form-ref=
"proFormRef"
:is-product=
"false"
@
accessoryTypeChange=
"handleAccessoryTypeChange"
@
handleAddBrandSupplyConfirm=
"handleAddBrandSupplyConfirm"
@
handleEditBrandSupplyConfirm=
"handleEditBrandSupplyConfirm"
>
</productForm>
</div>
<div
id=
"sourceMaterial-form"
class=
"sourceMaterial-form"
>
<div
class=
"title"
>
产品系列-SPU
</div>
<ProductForm
v-if=
"show"
ref=
"d2GoodsProductForm"
:add-or-edit=
"addOrEdit"
:form-list=
"editForm"
form-name=
"product"
:form-ref=
"proFormRef"
:is-product=
"false"
:origin-data=
"editData"
@
accessoryTypeChange=
"handleAccessoryTypeChange"
@
handleAddBrandSupplyConfirm=
"handleAddBrandSupplyConfirm"
@
handleEditBrandSupplyConfirm=
"handleEditBrandSupplyConfirm"
>
</ProductForm>
</div>
</
template
>
<
script
>
import
{
deepClone
}
from
'@/common/util'
import
{
mapActions
}
from
'vuex'
import
{
getBrandSupplyMerchant
,
addBrandSupplyMerchant
,
editBrandSupplyMerchant
,
getProductTypeBySceneId
,
getAllCategory
}
from
'@/api/product'
import
productForm
from
'./productForm.vue'
import
{
baseConfig
}
from
'@/main'
import
{
mapActions
}
from
"vuex"
;
import
{
addBrandSupplyMerchant
,
editBrandSupplyMerchant
,
getAllCategory
,
getBrandSupplyMerchant
,
getProductTypeBySceneId
}
from
"@/api/product"
;
import
{
deepClone
}
from
"@/common/util"
;
import
{
baseConfig
}
from
"@/main"
;
import
productForm
from
"./productForm.vue"
;
export
default
{
name
:
'SourceMaterial'
,
data
()
{
return
{
userInfo
:
this
.
$store
.
state
.
d2admin
.
user
.
info
,
show
:
false
,
editData
:
{
goodsName
:
''
,
goodsType
:
''
,
tempGoodsType
:
[],
goodsTypeName
:
''
,
sapCode
:
''
,
brandMerchantCode
:
''
,
brandMerchantName
:
''
,
supplierCode
:
''
,
supplierName
:
''
,
thumbUrl
:
''
,
goodsImgList
:
[],
goodsDescList
:
[],
videoUrl
:
''
,
convertedValue
:
''
,
positionIds
:
[],
carTypeList
:
[
1
,
2
,
3
,
4
],
goodsPositionList
:
[],
goodsSource
:
0
,
accessoryType
:
''
},
proFormRef
:
'pro'
,
editForm
:
[{
formBlock
:
[
{
name
:
'goodsName'
,
label
:
'产品名称'
,
type
:
'input'
,
maxlength
:
20
,
width
:
'432px'
,
isDisabled
:
false
},
{
name
:
'tempGoodsType'
,
label
:
'类目'
,
isRequired
:
true
,
type
:
'cascader'
,
isClear
:
false
,
isDisabled
:
false
,
optionList
:
[],
optionId
:
'categoryType'
,
optionLabel
:
'categoryName'
,
width
:
'432px'
},
{
name
:
'sapCode'
,
label
:
'编号'
,
type
:
'input'
,
maxlength
:
32
,
width
:
'432px'
},
{
name
:
'brandMerchantCode'
,
label
:
'品牌方'
,
isRequired
:
true
,
type
:
'special-select'
,
isClear
:
true
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'relatedPartyName'
,
partitionFlag
:
1
,
width
:
'432px'
},
{
name
:
'supplierCode'
,
label
:
'供应方'
,
isRequired
:
true
,
type
:
'select'
,
isClear
:
true
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'relatedPartyName'
,
partitionFlag
:
2
,
width
:
'432px'
,
isDisabled
:
false
},
{
name
:
'thumbUrl'
,
label
:
'缩略图'
,
type
:
'photo'
,
tips
:
[
'注:用于小程序主页商品列表配图展示'
,
'请上传10M以内的jpg、jpeg、png图片,建议图片尺寸256*216'
],
maxPhotoNum
:
1
},
{
name
:
'goodsImgList'
,
label
:
'产品主图'
,
type
:
'photo'
,
tips
:
[
'注:用于在小程序商品详情页的顶部展示'
,
'请上传10M以内的jpg、jpeg、png图片,建议图片尺寸256*216'
],
maxPhotoNum
:
10
},
{
name
:
'videoUrl'
,
label
:
'产品视频'
,
type
:
'video'
,
tips
:
[
'注:作为商品详情页顶部展示,格式建议mp4,大小不超过20M'
],
maxPhotoNum
:
1
},
{
name
:
'goodsDescList'
,
label
:
'详情描述'
,
type
:
'descList'
,
maxlength
:
256
},
{
name
:
'accessoryType'
,
label
:
'配件性质'
,
type
:
'radio'
,
isRequired
:
true
,
radioOptions
:
[
{
value
:
1
,
label
:
'原厂件'
},
{
value
:
2
,
label
:
'品牌件'
}
]
}]
}],
baseData
:
{
productType
:
[]
},
selfBuildGoodsType
:
baseConfig
.
selfBuildGoodsType
||
''
// 服务商自建类目值
}
},
name
:
"SourceMaterial"
,
components
:
{
productForm
:
productForm
},
components
:
{
ProductForm
:
productForm
,
},
props
:
{
addOrEdit
:
String
,
formData
:
Object
},
props
:
{
addOrEdit
:
String
,
formData
:
Object
,
},
data
()
{
return
{
userInfo
:
this
.
$store
.
state
.
d2admin
.
user
.
info
,
show
:
false
,
editData
:
{
goodsName
:
""
,
goodsType
:
""
,
tempGoodsType
:
[],
goodsTypeName
:
""
,
sapCode
:
""
,
brandMerchantCode
:
""
,
brandMerchantName
:
""
,
supplierCode
:
""
,
supplierName
:
""
,
thumbUrl
:
""
,
goodsImgList
:
[],
goodsDescList
:
[],
videoUrl
:
""
,
convertedValue
:
""
,
positionIds
:
[],
carTypeList
:
[
1
,
2
,
3
,
4
],
goodsPositionList
:
[],
goodsSource
:
0
,
accessoryType
:
""
,
},
proFormRef
:
"pro"
,
editForm
:
[{
formBlock
:
[
{
name
:
"goodsName"
,
label
:
"产品名称"
,
type
:
"input"
,
maxlength
:
20
,
width
:
"432px"
,
isDisabled
:
false
,
},
{
name
:
"tempGoodsType"
,
label
:
"类目"
,
isRequired
:
true
,
type
:
"cascader"
,
isClear
:
false
,
isDisabled
:
false
,
optionList
:
[],
optionId
:
"categoryType"
,
optionLabel
:
"categoryName"
,
width
:
"432px"
,
},
{
name
:
"sapCode"
,
label
:
"编号"
,
type
:
"input"
,
maxlength
:
32
,
width
:
"432px"
,
},
{
name
:
"brandMerchantCode"
,
label
:
"品牌方"
,
isRequired
:
true
,
type
:
"special-select"
,
isClear
:
true
,
optionList
:
[],
optionId
:
"id"
,
optionLabel
:
"relatedPartyName"
,
partitionFlag
:
1
,
width
:
"432px"
,
},
{
name
:
"supplierCode"
,
label
:
"供应方"
,
isRequired
:
true
,
type
:
"select"
,
isClear
:
true
,
optionList
:
[],
optionId
:
"id"
,
optionLabel
:
"relatedPartyName"
,
partitionFlag
:
2
,
width
:
"432px"
,
isDisabled
:
false
,
},
{
name
:
"thumbUrl"
,
label
:
"缩略图"
,
type
:
"photo"
,
tips
:
[
"注:用于小程序主页商品列表配图展示"
,
"请上传10M以内的jpg、jpeg、png图片,建议图片尺寸256*216"
],
maxPhotoNum
:
1
,
},
{
name
:
"goodsImgList"
,
label
:
"产品主图"
,
type
:
"photo"
,
tips
:
[
"注:用于在小程序商品详情页的顶部展示"
,
"请上传10M以内的jpg、jpeg、png图片,建议图片尺寸256*216"
],
maxPhotoNum
:
10
,
},
{
name
:
"videoUrl"
,
label
:
"产品视频"
,
type
:
"video"
,
tips
:
[
"注:作为商品详情页顶部展示,格式建议mp4,大小不超过20M"
],
maxPhotoNum
:
1
,
},
{
name
:
"goodsDescList"
,
label
:
"详情描述"
,
type
:
"descList"
,
maxlength
:
256
,
},
{
name
:
"accessoryType"
,
label
:
"配件性质"
,
type
:
"radio"
,
isRequired
:
true
,
radioOptions
:
[
{
value
:
1
,
label
:
"原厂件"
},
{
value
:
2
,
label
:
"品牌件"
},
],
},
],
}],
baseData
:
{
productType
:
[],
},
selfBuildGoodsType
:
baseConfig
.
selfBuildGoodsType
||
""
,
// 服务商自建类目值
};
},
mounted
()
{
if
(
this
.
addOrEdit
===
'edit'
)
{
this
.
show
=
false
this
.
editData
=
deepClone
(
this
.
formData
)
this
.
editData
.
brandMerchantCode
=
Number
(
deepClone
(
this
.
formData
).
brandMerchantCode
)
||
''
this
.
editData
.
supplierCode
=
Number
(
deepClone
(
this
.
formData
).
supplierCode
)
||
''
if
(
!
this
.
editData
.
goodsDescList
)
this
.
editData
.
goodsDescList
=
[]
// 太阳膜默认适用全部车型 部位回显
if
(
this
.
editData
.
goodsType
==
1
)
{
this
.
editData
.
carTypeList
=
deepClone
(
this
.
formData
).
carTypeList
?
deepClone
(
this
.
formData
).
carTypeList
:
[
1
,
2
,
3
,
4
]
this
.
editData
.
positionIds
=
deepClone
(
this
.
formData
)?.
goodsPositionList
?.
map
(
item
=>
{
return
item
.
position
})
}
this
.
editData
.
goodsImgList
=
this
.
editData
.
goodsImgList
||
[]
this
.
editData
.
goodsImgList
.
forEach
(
i
=>
{
delete
i
.
createdDate
delete
i
.
updatedDate
})
this
.
editData
.
goodsDescList
.
forEach
(
i
=>
{
delete
i
.
createdDate
delete
i
.
updatedDate
})
this
.
$nextTick
(()
=>
{
this
.
show
=
true
})
}
else
{
this
.
show
=
true
}
// 获取品牌方/供应方数据 1品牌商 2供应方
this
.
getBrandSupplyList
(
1
)
this
.
getBrandSupplyList
(
2
)
// 获取类目
this
.
getGoodTypeList
()
},
methods
:
{
...
mapActions
({
get
:
'd2admin/base/get'
,
close
:
'd2admin/page/close'
}),
// 获取全部类目 屏蔽服务商自建类目
getGoodTypeList
()
{
getAllCategory
({
categoryTypeList
:
this
.
selfBuildGoodsType
,
pageSize
:
9999
,
currentPage
:
1
}).
then
(
res
=>
{
const
obj
=
this
.
editForm
[
0
].
formBlock
[
this
.
editForm
[
0
].
formBlock
.
findIndex
(
val
=>
val
.
name
==
'tempGoodsType'
)]
obj
.
optionList
=
res
?.
list
||
[]
// SCRM同步过来商品 或者非草稿支持在当前类目下变更1.2.3级类目,不允许更换一级类目
if
(
this
.
addOrEdit
===
'edit'
&&
(
this
.
formData
?.
status
!=
3
||
this
.
formData
?.
scrmFlag
==
'Y'
))
{
obj
.
optionList
.
forEach
(
item
=>
{
if
(
item
.
categoryType
!=
this
.
editData
.
goodsType
)
{
item
.
disabled
=
true
item
?.
children
?.
forEach
(
i
=>
{
i
.
disabled
=
true
i
?.
children
?.
forEach
(
j
=>
{
j
.
disabled
=
true
})
})
}
})
}
else
{
const
goodsTypeIndex
=
this
.
editForm
[
0
]?.
formBlock
.
findIndex
(
val
=>
val
.
name
===
'tempGoodsType'
)
const
goodsTypeOptionList
=
this
.
editForm
[
0
]?.
formBlock
[
goodsTypeIndex
]?.
optionList
// 更新延保类目选项的 disabled 状态
const
updateGoodsTypeOptions
=
(
isDisabled
)
=>
{
const
updatedGoodsTypeOptionList
=
goodsTypeOptionList
.
map
(
item
=>
{
const
newItem
=
{
...
item
,
disabled
:
isDisabled
&&
this
.
baseConfig
?.
extendedPosiType
?.
includes
(
item
.
categoryType
)
};
if
(
newItem
.
children
)
{
newItem
.
children
=
newItem
.
children
.
map
(
i
=>
({
...
i
,
disabled
:
newItem
.
disabled
,
children
:
i
.
children
?
i
.
children
.
map
(
j
=>
({
...
j
,
disabled
:
newItem
.
disabled
}))
:
undefined
}))
}
return
newItem
})
this
.
$set
(
this
.
editForm
[
0
].
formBlock
[
goodsTypeIndex
],
'optionList'
,
updatedGoodsTypeOptionList
)
}
// 根据 supplierCode 更新延保类目选项
if
(
this
.
formData
?.
supplierCode
&&
!
this
.
baseConfig
?.
supplierCode
?.
includes
(
`
${
this
.
formData
?.
supplierCode
}
`)) {
updateGoodsTypeOptions(true)
} else {
updateGoodsTypeOptions(false)
}
}
// SCRM同步过来商品字段不可编辑
if (this.formData?.scrmFlag == 'Y') {
let disabledLabel = ['goodsName', 'supplierCode']
for (var i = 0; i < disabledLabel.length; i++) {
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == disabledLabel[i])].isDisabled = true
}
}
})
},
// 获取品牌/供应方
getBrandSupplyList(num) {
getBrandSupplyMerchant({
partitionFlag: num
}).then(res => {
if (num == 1) {
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == 'brandMerchantCode')].optionList = res
} else {
const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "supplierCode")
this.editForm[0].formBlock[supplierIndex].optionList = res
const suppOptionList = this.editForm[0]?.formBlock[supplierIndex]?.optionList
// 更新供应方选项的 disabled 状态
const updateSupplierOptions = (isDisabled) => {
suppOptionList?.forEach(item => {
item.isDisabled = isDisabled && !this.baseConfig?.supplierCode?.includes(`
$
{
item
.
id
}
`)
})
this.$set(this.editForm[0].formBlock[supplierIndex], 'optionList', suppOptionList)
}
// 根据 goodsType 更新供应方选项
if (this.baseConfig?.extendedPosiType?.includes(this.formData?.goodsType)) {
updateSupplierOptions(true)
} else {
updateSupplierOptions(false)
}
}
})
},
// 新增品牌商/供应商
handleAddBrandSupplyConfirm(data) {
addBrandSupplyMerchant(data).then(res => {
this.getBrandSupplyList(data.partitionFlag)
})
},
// 编辑删除 品牌商/供应商
handleEditBrandSupplyConfirm(data) {
editBrandSupplyMerchant(data).then(res => {
this.getBrandSupplyList(data.partitionFlag)
})
},
handleAccessoryTypeChange(val) {
this.$emit('accessoryTypeChange', val)
}
}
}
mounted
()
{
if
(
this
.
addOrEdit
===
"edit"
)
{
this
.
show
=
false
;
this
.
editData
=
deepClone
(
this
.
formData
);
this
.
editData
.
brandMerchantCode
=
Number
(
deepClone
(
this
.
formData
).
brandMerchantCode
)
||
""
;
this
.
editData
.
supplierCode
=
Number
(
deepClone
(
this
.
formData
).
supplierCode
)
||
""
;
if
(
!
this
.
editData
.
goodsDescList
)
this
.
editData
.
goodsDescList
=
[];
// 太阳膜默认适用全部车型 部位回显
if
(
this
.
editData
.
goodsType
==
1
)
{
this
.
editData
.
carTypeList
=
deepClone
(
this
.
formData
).
carTypeList
?
deepClone
(
this
.
formData
).
carTypeList
:
[
1
,
2
,
3
,
4
];
this
.
editData
.
positionIds
=
deepClone
(
this
.
formData
)?.
goodsPositionList
?.
map
((
item
)
=>
{
return
item
.
position
;
});
}
this
.
editData
.
goodsImgList
=
this
.
editData
.
goodsImgList
||
[];
this
.
editData
.
goodsImgList
.
forEach
((
i
)
=>
{
delete
i
.
createdDate
;
delete
i
.
updatedDate
;
});
this
.
editData
.
goodsDescList
.
forEach
((
i
)
=>
{
delete
i
.
createdDate
;
delete
i
.
updatedDate
;
});
this
.
$nextTick
(()
=>
{
this
.
show
=
true
;
});
}
else
{
this
.
show
=
true
;
}
// 获取品牌方/供应方数据 1品牌商 2供应方
this
.
getBrandSupplyList
(
1
);
this
.
getBrandSupplyList
(
2
);
// 获取类目
this
.
getGoodTypeList
();
},
methods
:
{
...
mapActions
({
get
:
"d2admin/base/get"
,
close
:
"d2admin/page/close"
,
}),
// 获取全部类目 屏蔽服务商自建类目
getGoodTypeList
()
{
getAllCategory
({
categoryTypeList
:
this
.
selfBuildGoodsType
,
pageSize
:
9999
,
currentPage
:
1
}).
then
((
res
)
=>
{
const
obj
=
this
.
editForm
[
0
].
formBlock
[
this
.
editForm
[
0
].
formBlock
.
findIndex
(
val
=>
val
.
name
==
"tempGoodsType"
)];
obj
.
optionList
=
res
?.
list
||
[];
// SCRM同步过来商品 或者非草稿支持在当前类目下变更1.2.3级类目,不允许更换一级类目
if
(
this
.
addOrEdit
===
"edit"
&&
(
this
.
formData
?.
status
!=
3
||
this
.
formData
?.
scrmFlag
==
"Y"
))
{
obj
.
optionList
.
forEach
((
item
)
=>
{
if
(
item
.
categoryType
!=
this
.
editData
.
goodsType
)
{
item
.
disabled
=
true
;
item
?.
children
?.
forEach
((
i
)
=>
{
i
.
disabled
=
true
;
i
?.
children
?.
forEach
((
j
)
=>
{
j
.
disabled
=
true
;
});
});
}
});
}
else
{
const
goodsTypeIndex
=
this
.
editForm
[
0
]?.
formBlock
.
findIndex
(
val
=>
val
.
name
===
"tempGoodsType"
);
const
goodsTypeOptionList
=
this
.
editForm
[
0
]?.
formBlock
[
goodsTypeIndex
]?.
optionList
;
// 更新延保类目选项的 disabled 状态
const
updateGoodsTypeOptions
=
(
isDisabled
)
=>
{
const
updatedGoodsTypeOptionList
=
goodsTypeOptionList
.
map
((
item
)
=>
{
const
newItem
=
{
...
item
,
disabled
:
isDisabled
&&
this
.
baseConfig
?.
extendedPosiType
?.
includes
(
item
.
categoryType
)
};
if
(
newItem
.
children
)
{
newItem
.
children
=
newItem
.
children
.
map
(
i
=>
({
...
i
,
disabled
:
newItem
.
disabled
,
children
:
i
.
children
?
i
.
children
.
map
(
j
=>
({
...
j
,
disabled
:
newItem
.
disabled
}))
:
undefined
,
}));
}
return
newItem
;
});
this
.
$set
(
this
.
editForm
[
0
].
formBlock
[
goodsTypeIndex
],
"optionList"
,
updatedGoodsTypeOptionList
);
};
// 根据 supplierCode 更新延保类目选项
if
(
this
.
formData
?.
supplierCode
&&
!
this
.
baseConfig
?.
supplierCode
?.
includes
(
`
${
this
.
formData
?.
supplierCode
}
`)) {
updateGoodsTypeOptions(true);
} else {
updateGoodsTypeOptions(false);
}
}
// SCRM同步过来商品字段不可编辑
if (this.formData?.scrmFlag == "Y") {
let disabledLabel = ["goodsName", "supplierCode"];
for (var i = 0; i < disabledLabel.length; i++) {
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == disabledLabel[i])].isDisabled = true;
}
}
});
},
// 获取品牌/供应方
getBrandSupplyList(num) {
getBrandSupplyMerchant({
partitionFlag: num,
}).then((res) => {
if (num == 1) {
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == "brandMerchantCode")].optionList = res;
} else {
const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "supplierCode");
this.editForm[0].formBlock[supplierIndex].optionList = res;
const suppOptionList = this.editForm[0]?.formBlock[supplierIndex]?.optionList;
// 更新供应方选项的 disabled 状态
const updateSupplierOptions = (isDisabled) => {
suppOptionList?.forEach((item) => {
item.isDisabled = isDisabled && !this.baseConfig?.supplierCode?.includes(`
$
{
item
.
id
}
`);
});
this.$set(this.editForm[0].formBlock[supplierIndex], "optionList", suppOptionList);
};
// 根据 goodsType 更新供应方选项
if (this.baseConfig?.extendedPosiType?.includes(this.formData?.goodsType)) {
updateSupplierOptions(true);
} else {
updateSupplierOptions(false);
}
}
});
},
// 新增品牌商/供应商
handleAddBrandSupplyConfirm(data) {
addBrandSupplyMerchant(data).then((res) => {
this.getBrandSupplyList(data.partitionFlag);
});
},
// 编辑删除 品牌商/供应商
handleEditBrandSupplyConfirm(data) {
editBrandSupplyMerchant(data).then((res) => {
this.getBrandSupplyList(data.partitionFlag);
});
},
handleAccessoryTypeChange(val) {
this.$emit("accessoryTypeChange", val);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.sourceMaterial-form
{
background
:
#ffffff
;
background
:
#ffffff
;
.title
{
height
:
50px
;
line-height
:
50px
;
padding
:
0
20px
;
border-bottom
:
1px
solid
#E5E5E
5
;
font-size
:
16px
;
font-weight
:
600
;
color
:
#333333
;
}
.title
{
height
:
50px
;
line-height
:
50px
;
padding
:
0
20px
;
border-bottom
:
1px
solid
#e5e5e
5
;
font-size
:
16px
;
font-weight
:
600
;
color
:
#333333
;
}
}
</
style
>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment