149 lines
3.1 KiB
Vue
149 lines
3.1 KiB
Vue
<template>
|
|
<view>
|
|
<view class="option-box">
|
|
<view class="tag-box">
|
|
<u-icon name="tags" color="#88e6b4" size="34"></u-icon>
|
|
<view class="name">技能类型</view>
|
|
</view>
|
|
<view class="span-box">
|
|
<view @click="changeGame(option)" class="span" :class="catId == option.id ? 'active': '' " v-for="(option,t) in optionList">{{option.name}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="option-box" v-if="categoryList.length > 0">
|
|
<view class="tag-box">
|
|
<u-icon name="tags" color="#88e6b4" size="34"></u-icon>
|
|
<view class="name">选项</view>
|
|
</view>
|
|
<view class="span-box">
|
|
<view @click="changeCategory(option)" class="span" :class="gameId == option.id ? 'active': '' " v-for="(option,t) in categoryList">{{option.name}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="option-box" v-if="goodsList.length > 0">
|
|
<view class="tag-box">
|
|
<u-icon name="tags" color="#88e6b4" size="34"></u-icon>
|
|
<view class="name">选项</view>
|
|
</view>
|
|
<view class="span-box">
|
|
<view @click="changeGoods(option)" class="span" :class="goodsId == option.id ? 'active': '' " v-for="(option,t) in goodsList">{{option.name}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
components: {
|
|
|
|
},
|
|
props: {
|
|
optionList: {
|
|
type: Array,
|
|
default: [],
|
|
},
|
|
modelValue: {
|
|
type: Object,
|
|
default: {}
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
catId: -1,
|
|
gameId: -1,
|
|
goodsId: -1,
|
|
categoryList: [],
|
|
goodsList: [],
|
|
goodsList: [],
|
|
}
|
|
},
|
|
methods: {
|
|
changeGame(e) {
|
|
this.gameId = -1;
|
|
this.goodsId = -1;
|
|
|
|
this.catId = e.id;
|
|
if(e.categoryList){
|
|
this.goodsList = [];
|
|
this.categoryList = e.categoryList;
|
|
}else{
|
|
this.categoryList = [];
|
|
this.goodsList = e.goodsList;
|
|
}
|
|
|
|
var node = {
|
|
catId: this.catId,
|
|
gameId: this.gameId,
|
|
goodsId: this.goodsId,
|
|
price: 0,
|
|
}
|
|
this.$emit('update:modelValue', node);
|
|
},
|
|
changeCategory(e) {
|
|
this.goodsId = -1;
|
|
this.gameId = e.id;
|
|
this.goodsList = e.goodsList;
|
|
|
|
var node = {
|
|
catId: this.catId,
|
|
gameId: this.gameId,
|
|
goodsId: this.goodsId,
|
|
price: 0,
|
|
}
|
|
this.$emit('update:modelValue', node);
|
|
},
|
|
changeGoods(e) {
|
|
this.goodsId = e.id;
|
|
var node = {
|
|
catId: this.catId,
|
|
gameId: this.gameId,
|
|
goodsId: this.goodsId,
|
|
price: e.price,
|
|
}
|
|
this.$emit('update:modelValue', node);
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.option-box {
|
|
margin-bottom: 10px;
|
|
|
|
.tag-box {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
|
|
.name {
|
|
font-size: 28rpx;
|
|
font-weight: 700;
|
|
color: #1a1a1a;
|
|
padding-left: 3px;
|
|
}
|
|
}
|
|
|
|
.span-box {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
.span {
|
|
padding: 10rpx 30rpx;
|
|
font-size: 28rpx;
|
|
background-color: #f5f5f5;
|
|
min-width: 120rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
border-radius: 40px;
|
|
margin-right: 7px;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.active {
|
|
background-color: var(--ui-BG-Main);
|
|
color: #fff;
|
|
}
|
|
}
|
|
}
|
|
</style> |