Commit c8d8823f by 杨明

fixed

1 parent 968cb330
<!-- 选择礼包弹窗 -->
<template>
<GLDialog mode="big" class="muti-gift" bigTitle="选择套餐内容" :hasFooter="hasFooter" :before-close="handleGoodsClose" @onOk="handleGoodsConfirm" @onCancel="handleGoodsClose" :visible.sync="isSelectGoodsVisible">
<GLDialog mode="big" class="muti-gift" bigTitle="选择内容" :hasFooter="hasFooter" :before-close="handleGoodsClose" @onOk="handleGoodsConfirm" @onCancel="handleGoodsClose" :visible.sync="isSelectGoodsVisible">
<div class="flex">
<div class="gift-table">
<el-tabs class="gift-tabs" v-model="activeName" @tab-click="handleTabClick">
......@@ -48,7 +48,7 @@
</div>
<div class="gift-content">
<template v-for="(subItem, subIndex) in selectedList[item].list">
<div class="gift-item" :key="subIndex">
<div class="gift-item" :key="subItem.id">
<img class="muti-icon" src="@/assets/muti-selected.png" @click="handleGoodsDelete(item, subIndex)" />
<el-tooltip effect="dark" placement="top" :disabled="couponString(subItem).length <= 8">
<p :class="['gift-coupon-name', 'ellipsis-1']">{{ couponString(subItem) > 8 ? couponString(subItem).slice(0, 8) + '...' : couponString(subItem) }}</p>
......@@ -94,6 +94,7 @@ export default {
list: []
}
},
initSelected: '',
scopeApplication: [
{
confId: '1',
......@@ -195,6 +196,7 @@ export default {
if (item.appearance == this.selectedList[i].appearance) this.selectedList[i].list.push(item)
})
}
this.initSelected = this.$common.utils.deepClone(this.selectedList)
this.getList({}, true)
this.brandList('brandName')
},
......@@ -246,6 +248,9 @@ export default {
this.$refs[this.activeName + 'Ref'].tableTotal = res.total
this.recoverySelected()
this.recoveryTotal()
this.$nextTick(() => {
this.initSelected = null
})
this.$refs[this.activeName + 'Ref'].tableHeightValues = '50vh'
})
.finally(() => {
......@@ -267,12 +272,12 @@ export default {
// 恢复选择
addSelected() {
this.$nextTick(() => {
var list = JSON.parse(JSON.stringify(this.selectedList[this.activeName].list))
// this.$refs[this.activeName + 'Ref'].$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
var list = this.$common.utils.deepClone(this.selectedList[this.activeName].list)
if (list && list.length) {
list.forEach(row => {
var idx = this.GoodsList.findIndex(k => k.id == row.id)
if (idx != -1) {
console.log(this.GoodsList[idx])
this.$refs[this.activeName + 'Ref'].$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(this.GoodsList[idx], true)
}
})
......@@ -317,9 +322,23 @@ export default {
this.selectedSum += this.selectedList[i].list.length
}
},
// getSelectionTable(list, val) {
// var currentIdList = this.GoodsList.map(item => item.id)
// var selectedIdList = list.map(item => item.id)
// val.forEach((item, index) => {
// const idx = currentIdList.indexOf(item.id)
// const idxs = selectedIdList.indexOf(item.id)
// if (idx == -1 && idxs == -1) {
// val.splice(index, 1)
// }
// })
// return val
// },
// 选择/取消
handleSelectionTable(val) {
var list = JSON.parse(JSON.stringify(this.selectedList[this.activeName].list))
const selectedList = this.initSelected ? this.initSelected[this.activeName].list : this.selectedList[this.activeName].list
// const val = this.getSelectionTable(selectedList, valp)
var list = this.$common.utils.deepClone(selectedList)
var count = 0
var currentIdList = this.GoodsList.map(item => item.id)
val
......@@ -334,6 +353,7 @@ export default {
}
val.forEach(item => {
let isSelected = list.find(k => k.id == item.id)
console.log(this.selectedList[this.activeName].list, item.id)
if (this.selectedList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
this.selectedList[this.activeName].list.push({
id: item.id,
......@@ -348,6 +368,7 @@ export default {
})
}
})
console.log(this.selectedList[this.activeName].list)
this.recoveryTotal()
},
handleGoodsConfirm() {
......@@ -369,7 +390,7 @@ export default {
}
if (selectedData.length == 0) {
this.$message.error('请选择商品优惠券')
this.$message.error('请选择平台福利券')
return
}
this.$emit('handleGoodsConfirm', selectedData)
......
......@@ -23,11 +23,12 @@
<span :class="['table-circle', scope.scope.activityStatus == 2 ? 'back-green' : 'back-grey']"></span>
<span>{{ orderStatus.find(item => item.confId == scope.scope.activityStatus)?.confName }}</span>
</div>
<!-- <div slot="coverUrl" slot-scope="scope">
<div class="image-popover" @click="handleLook(scope.scope)">
<img :src="scope.scope.coverUrl" />
<div slot="activityName" slot-scope="scope">
<div class="equity-ed">
<img src="@/assets/equity.png" v-if="filterCouponList(scope.scope.couponList, true).length" />
{{ scope.scope.activityName }}
</div>
</div> -->
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
......@@ -134,7 +135,9 @@ export default {
},
{
label: '活动名称',
prop: 'activityName'
prop: 'activityName',
addHtml: 'activityName',
width: 250
},
{
label: '商户名称',
......@@ -372,8 +375,8 @@ export default {
}
})
},
filterCouponList(list) {
return list.filter(item => item.discountType != 8)
filterCouponList(list, isEquity = false) {
return list.filter(item => (isEquity ? item.discountType == 8 : item.discountType != 8))
},
handleBoard(row) {
this.$router.push({
......@@ -614,4 +617,13 @@ export default {
.gift-detail .gift-item:last-child {
margin-right: 0;
}
.equity-ed {
display: flex;
align-items: center;
img {
width: 44px;
height: 22px;
margin-right: 6px;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!