Commit f4d03d85 by zhangquan

去掉可选链

1 parent c6334eea
...@@ -195,10 +195,10 @@ export default { ...@@ -195,10 +195,10 @@ export default {
equityCouponRequestList equityCouponRequestList
} }
this.$apis.goodsConponApi.createCoupons(params).then(res => { this.$apis.goodsConponApi.createCoupons(params).then(res => {
if (res?.length === 0) { if (res && res.length === 0) {
this.$message.success('创建成功') this.$message.success('创建成功')
this.$router.push({ path: '/goodsConpon/index' }) this.$router.push({ path: '/goodsConpon/index' })
} else if (res?.length > 0) { } else if (res && res.length > 0) {
this.errorConponList = selectedGoodsList.filter(item => res.indexOf(item.id) > -1) this.errorConponList = selectedGoodsList.filter(item => res.indexOf(item.id) > -1)
this.errorVisible = true this.errorVisible = true
} }
......
...@@ -201,12 +201,12 @@ export default { ...@@ -201,12 +201,12 @@ export default {
}) })
}, },
getBeforeChangeList(type = 1) { getBeforeChangeList(type = 1) {
let list = this.$refs?.tableRef?.mutiSelectArr?.[this.tableParams?.mutiSelectName] || [] let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || []
this[type == 2 ? 'conponList' : 'directChargeList'] = [...list] this[type == 2 ? 'conponList' : 'directChargeList'] = [...list]
}, },
onOk() { onOk() {
let selectedList = this.curType == 2 ? this.conponList : this.directChargeList let selectedList = this.curType == 2 ? this.conponList : this.directChargeList
let list = this.$refs?.tableRef?.mutiSelectArr?.[this.tableParams?.mutiSelectName] || [] let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || []
list = [...selectedList, ...list] list = [...selectedList, ...list]
for (let i = 0; i < this.selectedGoodsList.length; i++) { for (let i = 0; i < this.selectedGoodsList.length; i++) {
let idx = list.findIndex(item => item.id == this.selectedGoodsList[i].id) let idx = list.findIndex(item => item.id == this.selectedGoodsList[i].id)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!