packageView.vue
8.47 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
<!-- 查看上架 -->
<template>
<d2-container class="edit-commodity">
<div class="" v-if="show">
<detail ref="d2PackageDetail" :rules="rules" form-name="grounding" :origin-data="editData" :form-list="editForm"
@handleCheck="handleCheck"
@handleClose="handleAddClose"></detail>
</div>
</d2-container>
</template>
<script>
import { getPackageDetailInfo, batchCheckPackage } from '@api/packageManage'
import detail from './components/detail.vue'
import { sceneList, BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
import { deepClone, Util } from '@/common/util'
import { baseConfig } from "@/main"
import { packageGoodsDetail, upgradeSupplyModeList, crowdUpgradeSupplyModeList } from '../grounding/constants/data'
import { filterSpecsStr } from "../filterOption"
export default {
name: 'PackageDetail',
components: {
detail
},
data() {
return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
rules: {
merchantGoodsRefList: [{ required: true }],
packageName: [{ required: true }],
sceneName: [{ required: true }],
positionStr: [{ required: true }],
upgradeGoodsName: [{ required: true }],
sellPrice: [{ required: true }],
minSellPrice: [{ required: true }],
djCost: [{ required: true }],
thirdPartyCost: [{ required: true }],
upgradeProductCost: [{ required: true }],
recoveryCost: [{ required: true }],
virtualAccountCost: [{ required: true }],
financeCheckFlagStr: [{ required: true }]
},
editForm: [{
title: '套餐信息',
formBlock: [{
name: 'packageName',
label: '套餐名称'
}, {
name: 'packageAlias',
label: '套餐别名'
}, {
name: 'sellPrice',
label: '售价',
// unit: true
isPrice: true
}, {
name: 'minSellPrice',
label: '最低售价',
// unit: true
isPrice: true
}, {
name: 'upgradeProductCost',
label: '产品、升级成本',
// unit: true
isPrice: true
}, {
name: 'recoveryCost',
label: '回收成本',
// unit: true
isPrice: true
}, {
name: 'virtualAccountCost',
label: '虚拟对账成本',
// unit: true
isPrice: true
}, {
name: 'djCost',
label: '嘀加成本',
// unit: true
isPrice: true
}, {
name: 'thirdPartyCost',
label: '第三方成本',
// unit: true
isPrice: true
}, {
name: 'financeCheckFlagStr',
label: '财务规则校验'
}]
}, {
title: '商品信息',
formBlock: []
}, {
title: '门店信息',
formBlock: [{
name: 'sceneName',
label: '业务场景'
}, {
name: 'merchantGoodsRefList',
label: '上架门店',
type: 'table'
}, {
name: 'voucherList',
label: '上架凭证',
type: 'upload'
}]
}, {
title: '操作信息',
formBlock: [{
type: 'checkView',
name: 'reviewLogList'
}]
}],
show: false,
editData: {},
examineFlag: false,
detailId: '',
warrantyTypeShow: {
0: '质保卡',
1: '质保权益卡'
},
filterSpecsStr
}
},
mounted() {
this.getBaseData()
// 获取商品详情
const id = this.$route.params.id
this.detailId = id
if (!id) return this.show = true
this.getDetailInfo(id)
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
async getBaseData() {
this.positionTypeList = await this.get(BaseData.positionTypeList)
},
getDetailInfo(id) {
getPackageDetailInfo({ id }).then(res => {
res.reviewLogList?.forEach(val => {
val.updatedDateStr = val.updatedDate ? Util.dateFormate(val.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
})
let arr = []
if (res.sceneType == 3) { // 1.3场景 升级产品供货模式
arr = crowdUpgradeSupplyModeList
}
res.groundingGoodsList = []
res?.merchantGoodsInfoList?.forEach(val => {
if (val.goodsType == 1) { // 太阳膜类 升级产品供货模式(优先级高)
arr = upgradeSupplyModeList
}
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {}
const types = [goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName]
const result = types.filter(type => type).join('-')
this.editForm[1].formBlock.push(packageGoodsDetail)
// 太阳膜类回显部位
const positionNamesArr = deepClone(this.positionTypeList).filter(subVal => (val?.upgradeGoods?.position?.split(','))?.includes(subVal.position + '')) || []
res.groundingGoodsList.push({
goodsType: val?.goodsType, // 类目值
upgradeGoodsId: val?.upgradeGoodsId, // 升级商品Id
goodsAlias: val?.goodsAlias || '-', // 商品别名
positionStr: deepClone(this.positionTypeList)?.filter(subVal => val?.position == subVal.position)[0]?.confName || '', // 上架部位
sellPrice: val?.sellPrice, // 售价
minSellPrice: val?.minSellPrice, // 最低售价
validMinSellPrice: val?.validMinSellPrice, // 是否校验最低价
djCost: val?.djCost, // 嘀加成本
thirdPartyCost: val?.thirdPartyCost, // 第三方成本
supplierCode: val?.goodsInfo?.supplierCode, // 供应方
warrantyTypeStr: this.warrantyTypeShow[val?.warrantyType] || '-', // 质保卡类型
upgradeSupplyMode: val?.upgradeSupplyMode,
upgradeSupplyModeStr: arr?.filter(v => v.confId == val.upgradeSupplyMode)[0]?.confName || '', // 升级产品供货模式
upgradeProductCost: val?.upgradeProductCost, // 升级产品成本
virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本
recoveryCost: val?.recoveryCost, // 回收成本
warrantyPeriod: val?.upgradeGoods?.warrantyPeriod, // 质保年限
upgradePrice: val?.upgradeGoods?.upgradePrice, // 参考售价
upgradeGoods: {
...val?.upgradeGoods,
goodsName: val.goodsName,
upgradeGoodsName: val?.upgradeGoodsName,
goodsTypeName: val?.goodsTypeName, // 升级商品所属类目
tempGoodsTypeName: result,
serviceItemNames: val?.upgradeGoods?.upgradeGoodsServiceItemsList?.map(item => { return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}` })?.join(','), // 服务项目
positionNames: positionNamesArr.length ? positionNamesArr.map(subItem => { return subItem?.confName }).join('/') : '',
specificationData: this.filterSpecsStr(val?.upgradeGoods),
carTypeConfigName: val?.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join('/'),
upgradeCommodityCode: val?.upgradeCommodityCode
}
})
})
res.sceneName = sceneList[res.sceneType] || '-'
res.financeCheckFlagStr = res.financeCheckFlag == 'Y' ? '开启' : res.financeCheckFlag == 'N' ? '关闭' : '-'
res.merchantGoodsRefList = res.merchantGoodsRefList || []
res.voucherList = res?.voucherList || []
this.editData = res || {}
this.$nextTick(() => {
this.show = true
})
})
},
filterEmpty(data) {
return (data ?? '') === ''
},
handleCheck() {
this.$confirm('<p>审核通过后,套餐完成上架,对应的门店可使用该商品</p>是否确定审核?', '提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
batchCheckPackage({ ids: [this.detailId] }).then(res => {
this.notice.okTips()
this.handleClose(true)
})
}).catch(err => {
console.log(err)
})
},
handleClose() {
this.close({ tagName: '/packageManage' })
this.$router.push({ name: 'packageManage' })
this.close({ tagName: '/packageView' })
},
handleAddClose() {
this.handleClose()
}
}
}
</script>
<style lang="scss" scoped></style>