Commit b408b960 by 张立顺

fix sku编辑bug修复

1 parent cfe0edab
...@@ -76,12 +76,12 @@ ...@@ -76,12 +76,12 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示编码,延保不必填 --> <!-- 轻改/延保展示编码,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>商品编码</span> <span>商品编码</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span>第三方名称</span> <span>第三方名称</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
...@@ -90,32 +90,32 @@ ...@@ -90,32 +90,32 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示,延保不必填 --> <!-- 轻改/延保展示,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>计价单位</span> <span>计价单位</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>采购成本/元</span> <span>采购成本/元</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>质保时间/年</span> <span>质保时间/年</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>运营系数</span> <span>运营系数</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>运营成本</span> <span>运营成本</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>适用区域</span> <span>适用区域</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
...@@ -174,8 +174,7 @@ ...@@ -174,8 +174,7 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示配件性质,延保不必填 --> <!-- 轻改/延保展示配件性质,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" <td class="col-accessory-type"
class="col-accessory-type"
style="position: relative;"> style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>配件性质</span> <span>配件性质</span>
...@@ -212,7 +211,7 @@ ...@@ -212,7 +211,7 @@
:title="n"> :title="n">
{{ n }} {{ n }}
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.type" <el-input v-model.trim="row.item.type"
class="w-150-per w-150-per" class="w-150-per w-150-per"
:class="{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }" :class="{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }"
...@@ -222,7 +221,7 @@ ...@@ -222,7 +221,7 @@
@blur="handleTypeBlur($event, row.originalIndex)"> @blur="handleTypeBlur($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.thirdPartyName" <el-input v-model.trim="row.item.thirdPartyName"
class="w-150-per" class="w-150-per"
maxlength="50" maxlength="50"
...@@ -238,7 +237,7 @@ ...@@ -238,7 +237,7 @@
size="small"> size="small">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-select v-model="row.item.priceUnitType" <el-select v-model="row.item.priceUnitType"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }" :class="{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }"
...@@ -251,7 +250,7 @@ ...@@ -251,7 +250,7 @@
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.purchaseCost" <el-input v-model="row.item.purchaseCost"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }" :class="{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }"
...@@ -261,7 +260,7 @@ ...@@ -261,7 +260,7 @@
@input="handlePurchaseCostInput($event, row.originalIndex)"> @input="handlePurchaseCostInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.warrantyPeriod" <el-input v-model="row.item.warrantyPeriod"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }" :class="{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }"
...@@ -271,7 +270,7 @@ ...@@ -271,7 +270,7 @@
@input="handleWarrantyPeriodInput($event, row.originalIndex)"> @input="handleWarrantyPeriodInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.operationCoefficient" <el-input v-model="row.item.operationCoefficient"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }" :class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }"
...@@ -281,7 +280,7 @@ ...@@ -281,7 +280,7 @@
@input="handleOperationCoefficientInput($event, row.originalIndex)"> @input="handleOperationCoefficientInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.operationCost" <el-input v-model="row.item.operationCost"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }" :class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }"
...@@ -291,7 +290,7 @@ ...@@ -291,7 +290,7 @@
@input="handleOperationCostInput($event, row.originalIndex)"> @input="handleOperationCostInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.applicableArea" <el-input v-model.trim="row.item.applicableArea"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }" :class="{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }"
...@@ -460,8 +459,7 @@ ...@@ -460,8 +459,7 @@
<el-switch v-model="row.item.entityCardFlag"> <el-switch v-model="row.item.entityCardFlag">
</el-switch> </el-switch>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" <td class="col-accessory-type">
class="col-accessory-type">
<span class="sku-accessory-type">{{ formatAccessoryType(row.item.accessoryType) }}</span> <span class="sku-accessory-type">{{ formatAccessoryType(row.item.accessoryType) }}</span>
</td> </td>
<td style="width: 60px;"> <td style="width: 60px;">
......
This diff could not be displayed because it is too large.
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示商品编码,延保不必填 --> <!-- 轻改/延保展示商品编码,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>商品编码</span> <span>商品编码</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示第三方名称 --> <!-- 轻改/延保展示第三方名称 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span>第三方名称</span> <span>第三方名称</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
...@@ -38,32 +38,32 @@ ...@@ -38,32 +38,32 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示,延保不必填 --> <!-- 轻改/延保展示,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>计价单位</span> <span>计价单位</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>采购成本/元</span> <span>采购成本/元</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" style="position: relative;"> <td style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>质保时间/年</span> <span>质保时间/年</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>运营系数</span> <span>运营系数</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>运营成本</span> <span>运营成本</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </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 v-if="!isEquityOrExtendType && goodsInfoData.accessoryType !== 1" class="color-red">*</span>
<span>适用区域</span> <span>适用区域</span>
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
...@@ -125,8 +125,7 @@ ...@@ -125,8 +125,7 @@
<div class="resize-handle" @mousedown="onResizeStart"></div> <div class="resize-handle" @mousedown="onResizeStart"></div>
</td> </td>
<!-- 轻改/延保展示配件性质,延保不必填 --> <!-- 轻改/延保展示配件性质,延保不必填 -->
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" <td class="col-accessory-type"
class="col-accessory-type"
style="position: relative;"> style="position: relative;">
<span v-if="!isEquityOrExtendType" class="color-red">*</span> <span v-if="!isEquityOrExtendType" class="color-red">*</span>
<span>配件性质</span> <span>配件性质</span>
...@@ -192,7 +191,7 @@ ...@@ -192,7 +191,7 @@
</template> </template>
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.type" <el-input v-model.trim="row.item.type"
class="w-150-per w-150-per" class="w-150-per w-150-per"
:class="{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }" :class="{ 'border-red': !isEquityOrExtendType && filterEmpty(row.item.type) && row.item.typeEmpty }"
...@@ -203,7 +202,7 @@ ...@@ -203,7 +202,7 @@
@input="handleTypeInput($event, row.originalIndex)"> @input="handleTypeInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.thirdPartyName" <el-input v-model.trim="row.item.thirdPartyName"
class="w-150-per" class="w-150-per"
maxlength="50" maxlength="50"
...@@ -219,7 +218,7 @@ ...@@ -219,7 +218,7 @@
size="small"> size="small">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-select v-model="row.item.priceUnitType" <el-select v-model="row.item.priceUnitType"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }" :class="{ 'border-red': filterEmpty(row.item.priceUnitType) && row.item.priceUnitTypeEmpty }"
...@@ -232,7 +231,7 @@ ...@@ -232,7 +231,7 @@
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.purchaseCost" <el-input v-model="row.item.purchaseCost"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }" :class="{ 'border-red': (filterEmpty(row.item.purchaseCost) && row.item.purchaseCostEmpty) || row.item.purchaseCostRangeError }"
...@@ -242,7 +241,7 @@ ...@@ -242,7 +241,7 @@
@input="handlePurchaseCostInput($event, row.originalIndex)"> @input="handlePurchaseCostInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.warrantyPeriod" <el-input v-model="row.item.warrantyPeriod"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }" :class="{ 'border-red': (filterEmpty(row.item.warrantyPeriod) && row.item.warrantyPeriodEmpty) || row.item.warrantyPeriodRangeError }"
...@@ -252,7 +251,7 @@ ...@@ -252,7 +251,7 @@
@input="handleWarrantyPeriodInput($event, row.originalIndex)"> @input="handleWarrantyPeriodInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.operationCoefficient" <el-input v-model="row.item.operationCoefficient"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }" :class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCoefficient) && row.item.operationCoefficientEmpty) || row.item.operationCoefficientRangeError }"
...@@ -262,7 +261,7 @@ ...@@ -262,7 +261,7 @@
@input="handleOperationCoefficientInput($event, row.originalIndex)"> @input="handleOperationCoefficientInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model="row.item.operationCost" <el-input v-model="row.item.operationCost"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }" :class="{ 'border-red': (!isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.operationCost) && row.item.operationCostEmpty) || row.item.operationCostRangeError }"
...@@ -272,7 +271,7 @@ ...@@ -272,7 +271,7 @@
@input="handleOperationCostInput($event, row.originalIndex)"> @input="handleOperationCostInput($event, row.originalIndex)">
</el-input> </el-input>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)"> <td>
<el-input v-model.trim="row.item.applicableArea" <el-input v-model.trim="row.item.applicableArea"
class="w-150-per" class="w-150-per"
:class="{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }" :class="{ 'border-red': !isAccessoryTypeOriginal(row.item) && filterEmpty(row.item.applicableArea) && row.item.applicableAreaEmpty }"
...@@ -433,8 +432,7 @@ ...@@ -433,8 +432,7 @@
<el-switch v-model="row.item.entityCardFlag"> <el-switch v-model="row.item.entityCardFlag">
</el-switch> </el-switch>
</td> </td>
<td v-if="!equitySceneType.includes(goodsInfoData.goodsType)" <td class="col-accessory-type">
class="col-accessory-type">
<span class="sku-accessory-type">{{ formatAccessoryType(row.item.accessoryType) }}</span> <span class="sku-accessory-type">{{ formatAccessoryType(row.item.accessoryType) }}</span>
</td> </td>
<td style="width: 60px;"> <td style="width: 60px;">
......
<template> <template>
<div class="sourceMaterial-form" id="sourceMaterial-form"> <div id="sourceMaterial-form" class="sourceMaterial-form">
<div class="title">产品系列-SPU</div> <div class="title">
<productForm v-if="show" 产品系列-SPU
ref="d2GoodsProductForm" </div>
:add-or-edit="addOrEdit" <ProductForm v-if="show"
form-name="product" ref="d2GoodsProductForm"
:origin-data="editData" :add-or-edit="addOrEdit"
:form-list="editForm" :form-list="editForm"
:form-ref="proFormRef" form-name="product"
:is-product="false" :form-ref="proFormRef"
@accessoryTypeChange="handleAccessoryTypeChange" :is-product="false"
@handleAddBrandSupplyConfirm="handleAddBrandSupplyConfirm" :origin-data="editData"
@handleEditBrandSupplyConfirm="handleEditBrandSupplyConfirm"> @accessoryTypeChange="handleAccessoryTypeChange"
</productForm> @handleAddBrandSupplyConfirm="handleAddBrandSupplyConfirm"
</div> @handleEditBrandSupplyConfirm="handleEditBrandSupplyConfirm">
</ProductForm>
</div>
</template> </template>
<script> <script>
import { deepClone } from '@/common/util' import { mapActions } from "vuex";
import { mapActions } from 'vuex' import { addBrandSupplyMerchant, editBrandSupplyMerchant, getAllCategory, getBrandSupplyMerchant, getProductTypeBySceneId } from "@/api/product";
import { getBrandSupplyMerchant, addBrandSupplyMerchant, editBrandSupplyMerchant, getProductTypeBySceneId, getAllCategory } from '@/api/product' import { deepClone } from "@/common/util";
import productForm from './productForm.vue' import { baseConfig } from "@/main";
import { baseConfig } from '@/main' import productForm from "./productForm.vue";
export default { export default {
name: 'SourceMaterial', 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 || '' // 服务商自建类目值
}
},
components: { components: {
productForm: productForm ProductForm: productForm,
}, },
props: { props: {
addOrEdit: String, addOrEdit: String,
formData: Object 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() { mounted() {
if (this.addOrEdit === 'edit') { if (this.addOrEdit === "edit") {
this.show = false this.show = false;
this.editData = deepClone(this.formData) this.editData = deepClone(this.formData);
this.editData.brandMerchantCode = Number(deepClone(this.formData).brandMerchantCode) || '' this.editData.brandMerchantCode = Number(deepClone(this.formData).brandMerchantCode) || "";
this.editData.supplierCode = Number(deepClone(this.formData).supplierCode) || '' this.editData.supplierCode = Number(deepClone(this.formData).supplierCode) || "";
if (!this.editData.goodsDescList) this.editData.goodsDescList = [] 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] if (this.editData.goodsType == 1) {
this.editData.positionIds = deepClone(this.formData)?.goodsPositionList?.map(item => { return item.position }) this.editData.carTypeList = deepClone(this.formData).carTypeList ? deepClone(this.formData).carTypeList : [1, 2, 3, 4];
} this.editData.positionIds = deepClone(this.formData)?.goodsPositionList?.map((item) => {
this.editData.goodsImgList = this.editData.goodsImgList || [] return item.position;
this.editData.goodsImgList.forEach(i => { });
delete i.createdDate }
delete i.updatedDate this.editData.goodsImgList = this.editData.goodsImgList || [];
}) this.editData.goodsImgList.forEach((i) => {
this.editData.goodsDescList.forEach(i => { delete i.createdDate;
delete i.createdDate delete i.updatedDate;
delete i.updatedDate });
}) this.editData.goodsDescList.forEach((i) => {
this.$nextTick(() => { delete i.createdDate;
this.show = true delete i.updatedDate;
}) });
} else { this.$nextTick(() => {
this.show = true this.show = true;
} });
// 获取品牌方/供应方数据 1品牌商 2供应方 } else {
this.getBrandSupplyList(1) this.show = true;
this.getBrandSupplyList(2) }
// 获取类目 // 获取品牌方/供应方数据 1品牌商 2供应方
this.getGoodTypeList() this.getBrandSupplyList(1);
}, this.getBrandSupplyList(2);
methods: { // 获取类目
...mapActions({ this.getGoodTypeList();
get: 'd2admin/base/get', },
close: 'd2admin/page/close' methods: {
}), ...mapActions({
// 获取全部类目 屏蔽服务商自建类目 get: "d2admin/base/get",
getGoodTypeList() { close: "d2admin/page/close",
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 || [] getGoodTypeList() {
// SCRM同步过来商品 或者非草稿支持在当前类目下变更1.2.3级类目,不允许更换一级类目 getAllCategory({ categoryTypeList: this.selfBuildGoodsType, pageSize: 9999, currentPage: 1 }).then((res) => {
if (this.addOrEdit === 'edit' && (this.formData?.status != 3 || this.formData?.scrmFlag == 'Y')) { const obj = this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == "tempGoodsType")];
obj.optionList.forEach(item => { obj.optionList = res?.list || [];
if (item.categoryType != this.editData.goodsType) { // SCRM同步过来商品 或者非草稿支持在当前类目下变更1.2.3级类目,不允许更换一级类目
item.disabled = true if (this.addOrEdit === "edit" && (this.formData?.status != 3 || this.formData?.scrmFlag == "Y")) {
item?.children?.forEach(i => { obj.optionList.forEach((item) => {
i.disabled = true if (item.categoryType != this.editData.goodsType) {
i?.children?.forEach(j => { item.disabled = true;
j.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 状态 } else {
const updateGoodsTypeOptions = (isDisabled) => { const goodsTypeIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "tempGoodsType");
const updatedGoodsTypeOptionList = goodsTypeOptionList.map(item => { const goodsTypeOptionList = this.editForm[0]?.formBlock[goodsTypeIndex]?.optionList;
const newItem = { ...item, disabled: isDisabled && this.baseConfig?.extendedPosiType?.includes(item.categoryType) }; // 更新延保类目选项的 disabled 状态
if (newItem.children) { const updateGoodsTypeOptions = (isDisabled) => {
newItem.children = newItem.children.map(i => ({ const updatedGoodsTypeOptionList = goodsTypeOptionList.map((item) => {
...i, const newItem = { ...item, disabled: isDisabled && this.baseConfig?.extendedPosiType?.includes(item.categoryType) };
disabled: newItem.disabled, if (newItem.children) {
children: i.children ? i.children.map(j => ({ ...j, disabled: newItem.disabled })) : undefined newItem.children = newItem.children.map(i => ({
})) ...i,
} disabled: newItem.disabled,
return newItem children: i.children ? i.children.map(j => ({ ...j, disabled: newItem.disabled })) : undefined,
}) }));
this.$set(this.editForm[0].formBlock[goodsTypeIndex], 'optionList', updatedGoodsTypeOptionList) }
} return newItem;
// 根据 supplierCode 更新延保类目选项 });
if (this.formData?.supplierCode && !this.baseConfig?.supplierCode?.includes(`${this.formData?.supplierCode}`)) { this.$set(this.editForm[0].formBlock[goodsTypeIndex], "optionList", updatedGoodsTypeOptionList);
updateGoodsTypeOptions(true) };
} else { // 根据 supplierCode 更新延保类目选项
updateGoodsTypeOptions(false) if (this.formData?.supplierCode && !this.baseConfig?.supplierCode?.includes(`${this.formData?.supplierCode}`)) {
} updateGoodsTypeOptions(true);
} } else {
// SCRM同步过来商品字段不可编辑 updateGoodsTypeOptions(false);
if (this.formData?.scrmFlag == 'Y') { }
let disabledLabel = ['goodsName', 'supplierCode'] }
for (var i = 0; i < disabledLabel.length; i++) { // SCRM同步过来商品字段不可编辑
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == disabledLabel[i])].isDisabled = true 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 => { getBrandSupplyList(num) {
if (num == 1) { getBrandSupplyMerchant({
this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == 'brandMerchantCode')].optionList = res partitionFlag: num,
} else { }).then((res) => {
const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "supplierCode") if (num == 1) {
this.editForm[0].formBlock[supplierIndex].optionList = res this.editForm[0].formBlock[this.editForm[0].formBlock.findIndex(val => val.name == "brandMerchantCode")].optionList = res;
const suppOptionList = this.editForm[0]?.formBlock[supplierIndex]?.optionList } else {
// 更新供应方选项的 disabled 状态 const supplierIndex = this.editForm[0]?.formBlock.findIndex(val => val.name === "supplierCode");
const updateSupplierOptions = (isDisabled) => { this.editForm[0].formBlock[supplierIndex].optionList = res;
suppOptionList?.forEach(item => { const suppOptionList = this.editForm[0]?.formBlock[supplierIndex]?.optionList;
item.isDisabled = isDisabled && !this.baseConfig?.supplierCode?.includes(`${item.id}`) // 更新供应方选项的 disabled 状态
}) const updateSupplierOptions = (isDisabled) => {
this.$set(this.editForm[0].formBlock[supplierIndex], 'optionList', suppOptionList) suppOptionList?.forEach((item) => {
} item.isDisabled = isDisabled && !this.baseConfig?.supplierCode?.includes(`${item.id}`);
// 根据 goodsType 更新供应方选项 });
if (this.baseConfig?.extendedPosiType?.includes(this.formData?.goodsType)) { this.$set(this.editForm[0].formBlock[supplierIndex], "optionList", suppOptionList);
updateSupplierOptions(true) };
} else { // 根据 goodsType 更新供应方选项
updateSupplierOptions(false) if (this.baseConfig?.extendedPosiType?.includes(this.formData?.goodsType)) {
} updateSupplierOptions(true);
} } else {
}) updateSupplierOptions(false);
}, }
// 新增品牌商/供应商 }
handleAddBrandSupplyConfirm(data) { });
addBrandSupplyMerchant(data).then(res => { },
this.getBrandSupplyList(data.partitionFlag) // 新增品牌商/供应商
}) handleAddBrandSupplyConfirm(data) {
}, addBrandSupplyMerchant(data).then((res) => {
// 编辑删除 品牌商/供应商 this.getBrandSupplyList(data.partitionFlag);
handleEditBrandSupplyConfirm(data) { });
editBrandSupplyMerchant(data).then(res => { },
this.getBrandSupplyList(data.partitionFlag) // 编辑删除 品牌商/供应商
}) handleEditBrandSupplyConfirm(data) {
}, editBrandSupplyMerchant(data).then((res) => {
handleAccessoryTypeChange(val) { this.getBrandSupplyList(data.partitionFlag);
this.$emit('accessoryTypeChange', val) });
} },
} handleAccessoryTypeChange(val) {
} this.$emit("accessoryTypeChange", val);
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.sourceMaterial-form { .sourceMaterial-form {
background: #ffffff; background: #ffffff;
.title { .title {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
padding: 0 20px; padding: 0 20px;
border-bottom: 1px solid #E5E5E5; border-bottom: 1px solid #e5e5e5;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!