|
@@ -0,0 +1,121 @@
|
|
|
+<template>
|
|
|
+ <view class="flex">
|
|
|
+ <view class="type">
|
|
|
+ <view class="item" :style="{'background-color':index===typeCurrent?'#fff':'',color:index===typeCurrent?'rgb(89,146,187)':''}" v-for="(item,index) in typeArr" :key="item.code" @tap="chooseType(item.name,item.code,index)">{{item.name}}</view>
|
|
|
+ </view>
|
|
|
+ <view class="detialType">
|
|
|
+ <view style="padding-left: 15rpx;">{{typeName}}</view>
|
|
|
+ <view class="content">
|
|
|
+ <span v-for="item in detialTypeArr" :key="item.id">{{item.type.description}}</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState } from 'vuex';
|
|
|
+ export default {
|
|
|
+ name:"classfyBox",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ typeCode:'',
|
|
|
+ typeName:'',
|
|
|
+ typeCurrent: 0,
|
|
|
+ typeArr:[
|
|
|
+ {
|
|
|
+ name:'汽车美容',
|
|
|
+ code:'BEAUTY'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'汽车维修',
|
|
|
+ code:'REPAIR'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'汽车保养',
|
|
|
+ code:'MAINTAIN'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'租车服务',
|
|
|
+ code:'LEASE'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'买车卖车',
|
|
|
+ code:'TRADE'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'汽车改装',
|
|
|
+ code:'REFIT'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'其他服务',
|
|
|
+ code:'OTHER'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted(){
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ ...mapState(['data']),
|
|
|
+ detialTypeArr(){
|
|
|
+ return this.data.categories.filter(i=>i.type.code === this.typeCode)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ init(){
|
|
|
+ this.typeCode = this.typeArr[0].code
|
|
|
+ this.typeName = this.typeArr[0].name
|
|
|
+ },
|
|
|
+ chooseType(name,code,index){
|
|
|
+ this.typeName = name
|
|
|
+ this.typeCode = code
|
|
|
+ this.typeCurrent = index
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.flex{
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ height: 100vh;
|
|
|
+}
|
|
|
+.type{
|
|
|
+ height: 100%;
|
|
|
+ width: 200rpx;
|
|
|
+ background-color: rgb(225,225,225);
|
|
|
+ flex: none;
|
|
|
+ .item{
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+.detialType{
|
|
|
+ flex: auto;
|
|
|
+ height:100%;
|
|
|
+ padding: 10rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: rgb(239,239,239);
|
|
|
+}
|
|
|
+.content{
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns:repeat(4,125rpx);
|
|
|
+ grid-column-gap: 10rpx;
|
|
|
+ grid-row-gap: 30rpx;
|
|
|
+ justify-content: center;
|
|
|
+ align-content: center;
|
|
|
+ padding-top: 20rpx;
|
|
|
+ span{
|
|
|
+ background-color: rgb(204,204,204);
|
|
|
+ font-size: 24rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ text-align: center;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|