Commit c8d8823f by 杨明

fixed

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