|
@@ -162,21 +162,24 @@ const formatAllGoods = (data, kitGroupPurchaseType) => {
|
|
|
try {
|
|
|
courseJson = JSON.parse(item.coursePurchaseTypeJson)
|
|
|
} catch (error) {}
|
|
|
- const _item = {
|
|
|
- ...item,
|
|
|
- kitGroupPurchaseTypePrice: json[kitGroupPurchaseType],
|
|
|
- coursePurchaseTypeJsonTypePrice: courseJson[kitGroupPurchaseType]
|
|
|
- }
|
|
|
- musicalGoods.push(_item)
|
|
|
- musicalGoodsById[item.goodsIdList] = _item
|
|
|
- if (!types.ACCESSORIES) {
|
|
|
- if (!accessoriesByGoods[item.goodsIdList]) {
|
|
|
- accessoriesByGoods[item.goodsIdList] = []
|
|
|
+ if (json[kitGroupPurchaseType]) {
|
|
|
+ const _item = {
|
|
|
+ ...item,
|
|
|
+ kitGroupPurchaseTypePrice: json[kitGroupPurchaseType],
|
|
|
+ coursePurchaseTypeJsonTypePrice: courseJson[kitGroupPurchaseType],
|
|
|
+ _calculated_price: (kitGroupPurchaseType === 'FREE' ? 0 : (kitGroupPurchaseType === 'LEASE' ? item.depositFee : item.price))
|
|
|
}
|
|
|
- const acs = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
|
|
|
- for (const goods of acs) {
|
|
|
- accessoriesByGoods[item.goodsIdList].push(goods)
|
|
|
- accessoriesById[goods.id] = goods
|
|
|
+ musicalGoods.push(_item)
|
|
|
+ musicalGoodsById[item.goodsIdList] = _item
|
|
|
+ if (!types.ACCESSORIES) {
|
|
|
+ if (!accessoriesByGoods[item.goodsIdList]) {
|
|
|
+ accessoriesByGoods[item.goodsIdList] = []
|
|
|
+ }
|
|
|
+ const acs = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
|
|
|
+ for (const goods of acs) {
|
|
|
+ accessoriesByGoods[item.goodsIdList].push(goods)
|
|
|
+ accessoriesById[goods.id] = goods
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else if (item.type === 'ACCESSORIES') {
|
|
@@ -262,7 +265,7 @@ export default {
|
|
|
editSpread() {
|
|
|
const data = this.item
|
|
|
const payed = (data.originalAccessoriesPrice || 0) + (data.originalCourseFee || 0) + (data.originalMusicalPrice || 0)
|
|
|
- console.log(payed, data.changeMusicalPrice, data.changeAccessoriesPrice, data.changeCourseFee, {...data})
|
|
|
+ // console.log(payed, data.changeMusicalPrice, data.changeAccessoriesPrice, data.changeCourseFee, {...data})
|
|
|
return (data.changeMusicalPrice || 0) + (data.changeAccessoriesPrice || 0) + (data.changeCourseFee || 0) - payed
|
|
|
},
|
|
|
spread() {
|
|
@@ -353,7 +356,7 @@ export default {
|
|
|
musicalGoodsChange(val) {
|
|
|
const item = this.musicalGoodsById[val]
|
|
|
if (item) {
|
|
|
- this.musicalPrice = this.numFormat(item.price)
|
|
|
+ this.musicalPrice = this.numFormat(item._calculated_price)
|
|
|
this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypePrice)
|
|
|
this.coursePurchaseTypeJsonTypePrice = this.numFormat(item.coursePurchaseTypeJsonTypePrice)
|
|
|
} else {
|