You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bsdgy-front/src/pages/activity/useActivityStepThree.vue

125 lines
3.3 KiB
Vue

6 years ago
<template>
<div style="padding: 0 40px;">
<div class="selectClass">
<Checkbox v-model="allSelect" @on-change="isSelectAllCompany"></Checkbox>
6 years ago
<i-input icon="search" placeholder="请输入店铺名称或编码" style="width: 250px"></i-input>
</div>
<div class="companyTable">
<div class="companyListClass">
<div :class="isSelect[index] == true ? 'tagColorClass' : ''" class="tagClass" @click="selectTag(item,index)" v-for="(item, index) in shopList" :key="index" >{{item.label}}</div>
6 years ago
</div>
</div>
</div>
</template>
<script>
import ActivityManager from "../../services/ActivityManager/ActivityManager"
6 years ago
import store from "../../store/index"
6 years ago
export default {
name: "useActivityStepThree",
data() {
return {
allSelect: false,
shopList: [],
6 years ago
isSelect:[],
6 years ago
selectValue: [],
shopListData: []
6 years ago
}
},
mounted() {
this.getShopInfo()
6 years ago
},
methods: {
getShopInfo() {
let that = this
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
}
ActivityManager.getShop(data, function (data) {
that.shopList = []
6 years ago
that.shopListData = data.data.results
data.data.results.forEach(element => {
that.isSelect.push('')
that.selectValue.push('')
that.shopList.push({
label: element.name,
value: element.id
})
});
})
},
isSelectAllCompany() {
if(this.allSelect === true) {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,true)
})
this.shopList.forEach((element,index) => {
this.selectValue.splice(index,1,element.id)
})
} else {
this.isSelect.forEach((element,index) => {
this.isSelect.splice(index,1,'')
})
this.shopList.forEach((element,index) => {
this.selectValue.splice(index,1,'')
})
}
},
6 years ago
selectTag(value,index) {
this.isSelect.splice(index,1,!this.isSelect[index])
if(this.isSelect[index] === true) {
6 years ago
this.selectValue.splice(index, 1, value.value)
6 years ago
} else if(this.isSelect[index] === false) {
this.selectValue.splice(index, 1, '')
}
6 years ago
let selectShopValue = []
this.isSelect.forEach((element,index) => {
if(element === true) {
selectShopValue.push(this.selectValue[index])
}
})
let selectShopValueObject = []
for(let j=0; j< selectShopValue.length; j++) {
for(let i = 0; i< this.shopList.length; i++){
if(this.shopList[i].value === selectShopValue[j]) {
selectShopValueObject.push(this.shopListData[i])
}
}
}
store.getters.useData.selectShopValue = selectShopValueObject
6 years ago
}
}
}
</script>
<style scoped>
.selectClass {
display: flex;
justify-content: space-between;
}
.companyTable {
width: 3150px;
height: 1000px;
border: 1px solid;
margin-top: 40px;
padding: 40px;
overflow:scroll;
}
.companyListClass {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.tagClass {
width: 31%;
margin-bottom: 30px;
height: 120px;
line-height: 120px;
border: 1px solid #e3e8ee!important;
color: #657180!important;
background: #fff;
padding: 0 12px;
}
.tagColorClass {
background: #6ac1d1;
}
</style>