|
@@ -19,6 +19,7 @@ import { mapState, mapMutations } from 'vuex'
|
|
|
import { schemaKeyMap, productKeyMap, productGroupKeyMap, productTypeMap } from '@/views/create-order/data'
|
|
|
import { cloneDeep, debounce } from 'lodash'
|
|
|
import { deepEqual } from '@/utils/object'
|
|
|
+import { getIntersection } from '@/utils/utils'
|
|
|
|
|
|
const dhy001 = 'dyh001'
|
|
|
|
|
@@ -137,7 +138,7 @@ export default {
|
|
|
},
|
|
|
// 数组求交集
|
|
|
getIntersection(arr1, arr2) {
|
|
|
- return arr1.filter(value => arr2.includes(value))
|
|
|
+ return getIntersection(arr1, arr2)
|
|
|
},
|
|
|
onInput(e) {
|
|
|
this.emitInput(e)
|
|
@@ -479,18 +480,23 @@ export default {
|
|
|
if (p.selected[0]) {
|
|
|
const t = p.selected[0]
|
|
|
this.selectedRelatedOrder = t
|
|
|
+ this.syncSelectedRelateOrder(this.selectedRelatedOrder)
|
|
|
// 更新serviceList(续费升级需要回传)
|
|
|
if (Array.isArray(t.serviceList)) {
|
|
|
Object.assign(refreshObj, { serviceList: [...new Set(t.serviceList)] })
|
|
|
}
|
|
|
} else {
|
|
|
this.selectedRelatedOrder = {}
|
|
|
+ this.syncSelectedRelateOrder(this.selectedRelatedOrder)
|
|
|
}
|
|
|
// 自动选择完成后,需要触发一次更新
|
|
|
this.refreshValue(refreshObj)
|
|
|
this.triggerRefreshSchema()
|
|
|
})
|
|
|
},
|
|
|
+ syncSelectedRelateOrder(s) {
|
|
|
+ this.refreshValue({ selectedRelatedOrder: s })
|
|
|
+ },
|
|
|
// common: 升级内容
|
|
|
commonChangeUpgradeContentSchema(value = this.value || {}) {
|
|
|
const { buySubject } = this.pageForm
|
|
@@ -509,9 +515,9 @@ export default {
|
|
|
uc.props.options = uc.props.options.filter(c => !c.subCount)
|
|
|
}
|
|
|
|
|
|
- if (uc.props.options.length === 1) {
|
|
|
- this.refreshValue({ [schemaKeyMap.upgradeContent]: [uc.props.options[0].value] })
|
|
|
- }
|
|
|
+ // if (uc.props.options.length === 1) {
|
|
|
+ // this.refreshValue({ [schemaKeyMap.upgradeContent]: [uc.props.options[0].value] })
|
|
|
+ // }
|
|
|
}
|
|
|
},
|
|
|
// 账号数量、主账号/子账号数量
|
|
@@ -531,7 +537,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 1.子账号展示:满足以下任意条件即展示:
|
|
|
- const hasAddSubAccount = true // 是否勾选了增购子账号
|
|
|
+ const hasAddSubAccount = Array.isArray(value.upgradeContent) && value.upgradeContent.includes(2) // 是否勾选了增购子账号
|
|
|
// (1)产品属性为“会员服务”且购买主体为“企业”且付费类型不是升级;
|
|
|
const entNotUpgrade = this.utilCheckIsVipService() && buySubject === 2 && payment !== 3
|
|
|
// (2)产品属性为“会员服务”且购买主体为“企业”且付费类型是升级且升级内容有“增购子账号”;
|
|
@@ -544,6 +550,7 @@ export default {
|
|
|
const show = entNotUpgrade || entUpgradeAddSubAccount || bigNotUpgrade || bigNotUpgradeAddSubAccount
|
|
|
main.show = show
|
|
|
sub.show = show
|
|
|
+ sub.label = '子账号数量'
|
|
|
|
|
|
// 2.账号展示规则
|
|
|
// (1)主账号默认为1个;
|
|
@@ -553,7 +560,8 @@ export default {
|
|
|
// 特殊情况说明如下:付费类型为续费,则反显关联订单付费和赠送账号数量,不支持修改,历史数据0元订单,默认为赠送,非0元订单,都默认为付费。
|
|
|
|
|
|
// 计算主账号1个+子账号+赠送账号的和
|
|
|
- const mainAccountCount = 1
|
|
|
+ // 升级-增购子账号则不计算主账号
|
|
|
+ const mainAccountCount = payment === 3 ? 0 : 1
|
|
|
let allTotal = 0
|
|
|
allTotal += mainAccountCount
|
|
|
if (subAccountNumbers) {
|
|
@@ -570,11 +578,16 @@ export default {
|
|
|
Object.assign(refreshObj, { subAccountNumbers })
|
|
|
// 禁用
|
|
|
}
|
|
|
+ sub.required = false
|
|
|
this.$set(sub.props, 'disabled', true)
|
|
|
} else if (payment === 3) {
|
|
|
// 升级
|
|
|
-
|
|
|
+ main.show = false
|
|
|
+ sub.required = true
|
|
|
+ sub.label = '账号数量'
|
|
|
+ this.$set(sub.props, 'disabled', false)
|
|
|
} else {
|
|
|
+ sub.required = false
|
|
|
this.$set(sub.props, 'disabled', false)
|
|
|
}
|
|
|
this.refreshValue(refreshObj)
|
|
@@ -911,6 +924,14 @@ export default {
|
|
|
// 销售策略变更,清空有效周期(通用规则)
|
|
|
this.refreshValue({ validityPeriod: {} })
|
|
|
}
|
|
|
+ if (changedArr.includes('saleGifts') || changedArr.includes(schemaKeyMap.specification)) {
|
|
|
+ // 付费类型变更,如果有主账号数量,则清空
|
|
|
+ if (this.value.subAccountNumbers) {
|
|
|
+ const subAccountNumbers = { payCount: '', freeCount: '' }
|
|
|
+ this.refreshValue({ subAccountNumbers })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
console.log('以下字段变更了:', changedArr)
|
|
|
},
|
|
|
checkNeedRefreshPrice(changedArr) {
|