GoodsInfo.vue
12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<template>
<div class="goods-components gl-form-page">
<div class="title">商品信息</div>
<div class="detail_pannel" v-for="(item, index) in goodsInfo" :key="index">
<div class="item_label">上架商品:</div>
<div class="item_value">
<div class="incid_box">
<div class="item" v-for="(subItem, subIndex) in detailInfo" :key="subIndex">
<div class="label">{{ subItem.unit ? (membraneTypeList.includes(item['goodsType']) ? subItem.label +
`(元)/${subItem.value == 'purchasePrice' ? '卷' : '车'}` : (subItem.label + '(元)/件')) : subItem.label }}:</div>
<div class="value">{{ subItem.unit ? (priceFilter(item[subItem.value]) || '-') : (item[subItem.value] || '-') }}</div>
</div>
<!-- 商品分类 延保类 -->
<div class="item" v-if="item['goodsType'] == 1 || (extendedPosiType.includes(item['goodsType']) && !supplierCode.includes(item['supplierCode'] + ''))">
<div class="label">部位:</div>
<div class="value">{{ item['positionNames'] || '-' }}</div>
</div>
<!-- 质保年限 膜类展示-->
<div class="item" v-if="membraneTypeList.includes(item['goodsType'])">
<div class="label">质保年限/年:</div>
<div class="value">{{ item['warrantyPeriod'] || '-' }}</div>
</div>
<!-- 商品分类 权益升级 -->
<div class="item" v-if="equitySceneType.includes(item['goodsType']) && !supplierCode.includes(item['supplierCode'] + '')">
<div class="label">服务时间/年:</div>
<div class="value">{{ item['serviceYears'] || '-' }}</div>
</div>
<!-- 商品分类 权益升级 -->
<div class="item" v-if="equitySceneType.includes(item['goodsType'])">
<div class="label">实体卡:</div>
<div class="value">{{ item['entityCardFlag'] == 'Y' ? '是' : '否' }}</div>
</div>
<div class="item" v-if="equitySceneType.includes(item['goodsType']) || extendedPosiType.includes(item['goodsType'])">
<div class="label">适用车价:</div>
<div v-if="!filterEmpty(item['minSuitCarPrice']) && !filterEmpty(item['maxSuitCarPrice'])">{{ item['minSuitCarPrice'] }} - {{ item['maxSuitCarPrice'] }}万</div>
<div v-else>-</div>
</div>
<!-- 商品分类 权益升级 -->
<div class="item flex_1" v-if="equitySceneType.includes(item['goodsType']) && !supplierCode.includes(item['supplierCode'] + '')">
<div class="label">服务项目:</div>
<div class="value">{{ item['serviceItemNames'] || '-' }}</div>
</div>
</div>
<div class="grounding_box">
<!-- 太阳膜/延保类(第三方供应方)时展示 -->
<div class="grounding_item" v-if="(extendedPosiType.includes(item['goodsType']) && !supplierCode.includes(item['supplierCode'] + '')) || item['goodsType'] == 1">
<div class="label">上架部位:</div>
<div class="value">{{ item['positionStr'] || '-' }}</div>
</div>
<div class="grounding_item">
<div class="label">商品别名:</div>
<div class="value">{{ item['goodsAlias'] || '-' }}</div>
</div>
<!-- 太阳膜时展示 -->
<div class="grounding_item" v-if="item['goodsType'] == 1">
<div class="label">质保卡类型:</div>
<div class="value">{{ item['warrantyTypeStr'] || '-' }}</div>
</div>
<!-- 太阳膜/售后众筹场景时展示 -->
<div class="grounding_item" v-if="item['goodsType'] == 1 || item['sceneType'] == 3">
<div class="label">升级产品供货模式:</div>
<div class="value">{{ item['upgradeSupplyModeStr'] || '-' }}</div>
</div>
<div class="grounding_item">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '售价(元)/车:' : '售价(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['sellPrice']) || '-' }}</div>
</div>
<div class="grounding_item">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '最低售价(元)/车:' : '最低售价(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['minSellPrice']) || '-' }}</div>
</div>
<!-- 非权益/延保类或售后众筹场景时展示 -->
<div class="grounding_item" v-if="!equitySceneType.includes(item['goodsType']) && !extendedPosiType.includes(item['goodsType']) || item['sceneType'] == 3">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '产品、升级成本(元)/车:' : '产品、升级成本(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['upgradeProductCost']) || '-' }}</div>
</div>
<!-- 产品供货模式选择“门店回收原厂+嘀加”时展示 -->
<div class="grounding_item" v-if="item['upgradeSupplyMode'] == 4">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '回收成本(元)/车:' : '回收成本(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['recoveryCost']) || '-' }}</div>
</div>
<!-- 产品供货模式选择“门店套码+嘀加”“ 服务商自采+嘀加”时展示 -->
<div class="grounding_item" v-if="item['upgradeSupplyMode'] == 3 || item['upgradeSupplyMode'] == 5">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '虚拟对账成本(元)/车:' : '虚拟对账成本(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['virtualAccountCost']) || '-' }}</div>
</div>
<!-- 权益类目/延保类目 -->
<div class="grounding_item" v-if="equitySceneType.includes(item['goodsType']) || extendedPosiType.includes(item['goodsType'])">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '嘀加成本(元)/车:' : '嘀加成本(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['djCost']) || '-' }}</div>
</div>
<!-- 权益类目/延保类目 -->
<div class="grounding_item" v-if="equitySceneType.includes(item['goodsType']) || extendedPosiType.includes(item['goodsType'])">
<div class="label">{{ membraneTypeList.includes(item['goodsType']) ? '第三方成本(元)/车:' : '第三方成本(元)/件:' }}</div>
<div class="value">{{ priceFilter(item['thirdPartyCost']) || '-' }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { fetchConfig } from '@/config'
import { upgradeSupplyModeList, crowdUpgradeSupplyModeList } from '@/common/constant'
export default {
name: 'GoodsInfo',
props: {
goodsInfo: Array
},
data() {
return {
equitySceneType: [], // 权益类目
extendedPosiType: [], // 延保类
membraneTypeList: [], // 膜类
supplierCode: [], // 第三方供应商编码
detailInfo: [
{
label: '商品名称',
value: 'upgradeGoodsName'
},
{
label: '商品编码',
value: 'type'
},
{
label: '第三方编码',
value: 'thirdPartyCode'
},
{
label: '采购价',
value: 'purchasePrice',
unit: true
},
{
label: '参考售价',
value: 'upgradePrice',
unit: true
},
{
label: '所属系列',
value: 'goodsName'
},
{
label: '所属分类',
value: 'goodsTypeName'
},
{
label: '商品ID',
value: 'upgradeCommodityCode'
}
],
warrantyTypeShow: {
0: '质保卡',
1: '质保权益卡'
}
}
},
mounted() {
this.getBaseConfig()
},
methods: {
// 获取配置服务上面配置的类目
async getBaseConfig() {
try {
const { equitySceneType, extendedPosiType, membraneTypeList, supplierCode } = await fetchConfig()
this.equitySceneType = equitySceneType
this.extendedPosiType = extendedPosiType
this.membraneTypeList = membraneTypeList
this.supplierCode = supplierCode
// 获取商品部位数据
const positionTypeList = await this.$apis.contractManager.getProdPartListApi({goodsType: 1}) // 太阳膜
const extendedPosiTypeList = await this.$apis.contractManager.getProdPartListApi({ goodsType: extendedPosiType && extendedPosiType[0] }) // 延保
this.goodsInfo?.forEach(val => {
const { upgradeGoods, goodsInfo, warrantyType, upgradeSupplyMode } = val
const positionNamesArr = this.$common.utils.deepClone(positionTypeList.concat(extendedPosiTypeList)).filter(subVal => (upgradeGoods?.position?.split(','))?.includes(subVal.position + '')) || []
const arr = val.goodsType == 1 ? upgradeSupplyModeList : crowdUpgradeSupplyModeList
val.positionStr = this.$common.utils.deepClone(positionTypeList.concat(extendedPosiTypeList)).filter(subVal => val?.position == subVal.position)[0]?.confName || '' // 上架部位
val.positionNames = positionNamesArr.length ? positionNamesArr.map(subItem => subItem?.confName).join('/') : '' // 部位名称
val.purchasePrice = upgradeGoods?.purchasePrice // 采购价
val.serviceYears = upgradeGoods?.serviceYears // 服务时间
val.serviceItemNames = upgradeGoods?.upgradeGoodsServiceItemsList?.map(v => `${v.serviceName}-${v.serviceGrade}/${v.servicePeriod}`).join(',') // 服务项目
val.type = upgradeGoods?.type // 编码
val.thirdPartyCode = upgradeGoods?.thirdPartyCode // 第三方编码
val.entityCardFlag = upgradeGoods?.entityCardFlag // 是否实体卡
val.minSuitCarPrice = upgradeGoods?.minSuitCarPrice // 适用车价最低价
val.maxSuitCarPrice = upgradeGoods?.maxSuitCarPrice // 适用车价最高价
val.supplierCode = goodsInfo?.supplierCode // 供应方
val.warrantyTypeStr = this.warrantyTypeShow[warrantyType] || '-' // 质保卡类型
val.warrantyPeriod = upgradeGoods?.warrantyPeriod // 质保年限
val.upgradePrice = upgradeGoods?.upgradePrice // 参考售价
val.upgradeSupplyModeStr = arr?.filter(v => v.confId == upgradeSupplyMode)[0]?.confName || '' // 升级产品供货模式
})
} catch (error) {
console.log(error)
}
},
// 处理金额补零
priceFilter(num) {
var pow = Math.pow(10, 2)
if (this.filterEmpty(num)) return '-'
return (Math.round(num * pow) / pow).toFixed(2)
},
filterEmpty(data) {
return (data ?? '') === ''
}
}
}
</script>
<style lang="scss" scoped>
.goods-components {
margin-top: 10px;
background: white;
.title {
padding: 0 20px;
font-size: 16px;
font-weight: bold;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #d8d8d8;
margin: 0 0;
color: #333;
}
.edit-form-container {
padding: 32px 0 12px;
}
.detail_pannel {
display: flex;
padding: 32px 20px 12px;
border-bottom: 1px solid #e8e8ea;
font-size: 14px;
&:last-child {
border: none;
}
.item_label {
width: 160px;
text-align: right;
color: #666666;
}
.item_value {
width: 100%;
.incid_box {
background: #f9f9f9;
display: flex;
flex-wrap: wrap;
padding: 10px 0;
.item{
flex: 0 0 33%;
margin: 10px 0;
display: flex;
.label{
width: 160px;
text-align: right;
color: #333333;
}
}
.flex_1{
flex: 0 0 100%;
.value{
line-height: 30px;
margin-top: -8px;
}
}
}
.grounding_box {
display: flex;
flex-wrap: wrap;
padding: 10px 0;
.grounding_item{
flex: 0 0 33%;
margin: 10px 0;
display: flex;
.label{
width: 160px;
text-align: right;
color: #333333;
}
}
}
}
}
}
</style>