|
|
@@ -1,17 +1,11 @@
|
|
|
<template>
|
|
|
<view class="shop-listType_box">
|
|
|
<view class="shop-type_box">
|
|
|
- <view v-for="item in shopListType" :key="item.id" :class="[selectTypeId===item.id?'active':'']" @click="changeType(item)" > {{item.name}} </view>
|
|
|
+ <view v-for="item in shopListType" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeType(item)" > {{item.name}} </view>
|
|
|
</view>
|
|
|
<view class="shop-show_box">
|
|
|
- <view @click="kdSelectItem(item)" v-for="item in currenTypeShopList" :key="item.id" class="show-shop_box">
|
|
|
- <image class="img" :src="item.cover" mode="scaleToFill" ></image>
|
|
|
- <view class="shop-info_price">
|
|
|
- <view>
|
|
|
- <view>{{item.name}}</view>
|
|
|
- <view>¥{{parseFloat(item.price)}}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <view v-for="item in currenTypeShopList" :key="item.id" class="show-shop_box">
|
|
|
+ <rightItemComponent :info="item"></rightItemComponent>
|
|
|
</view>
|
|
|
</view>
|
|
|
<slot name="footer"></slot>
|
|
|
@@ -19,14 +13,15 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import settlePop from './settle-pop.vue'
|
|
|
+import rightItemComponent from './rightItem.vue'
|
|
|
import { showClass,showList } from '@/api/home/index'
|
|
|
export default {
|
|
|
name:'rightItemArea',
|
|
|
- components:{ settlePop },
|
|
|
+ components:{ settlePop,rightItemComponent },
|
|
|
data(){
|
|
|
return {
|
|
|
shopListType:[],
|
|
|
- selectTypeId: '',
|
|
|
+ categoryId: '',
|
|
|
arrShop:[],
|
|
|
currenTypeShopList:[],
|
|
|
isShowSettle: false,
|
|
|
@@ -37,19 +32,17 @@ export default {
|
|
|
this.init()
|
|
|
},
|
|
|
watch:{
|
|
|
- selectItem(){
|
|
|
- console.log(3333,this.selectItem)
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
methods:{
|
|
|
+ showAddModelFn(item) {
|
|
|
+ this.$emit("showAddModelFn", { ...item, bigCount: 1, smallCount: '', userPrice: item.price})
|
|
|
+ },
|
|
|
async init(){
|
|
|
- try {
|
|
|
- let { data } = await showClass()
|
|
|
- this.shopListType = data
|
|
|
- this.selectTypeId = this.shopListType[0].id
|
|
|
- this.getShowList()
|
|
|
- }catch(err){
|
|
|
- }
|
|
|
+ let { data } = await showClass()
|
|
|
+ this.shopListType = data
|
|
|
+ this.categoryId = this.shopListType[0].id
|
|
|
+ this.getShowList()
|
|
|
},
|
|
|
async getShowList(){
|
|
|
try {
|
|
|
@@ -60,18 +53,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
updateCurrentShop(){
|
|
|
- this.currenTypeShopList = this.arrShop[this.selectTypeId]
|
|
|
+ this.currenTypeShopList = this.arrShop[this.categoryId]
|
|
|
},
|
|
|
changeType(item){
|
|
|
- if(item.id === this.selectTypeId){
|
|
|
+ if(item.id === this.categoryId){
|
|
|
return false
|
|
|
}
|
|
|
- this.selectTypeId = item.id
|
|
|
+ this.categoryId = item.id
|
|
|
this.updateCurrentShop()
|
|
|
},
|
|
|
- kdSelectItem(item){
|
|
|
- this.$emit('kdSelectItem',item)
|
|
|
- },
|
|
|
settle(){
|
|
|
this.isShowSettle = true
|
|
|
}
|
|
|
@@ -110,37 +100,6 @@ export default {
|
|
|
flex-wrap: wrap;
|
|
|
overflow-y: scroll;
|
|
|
overflow-x: hidden;
|
|
|
- & .show-shop_box {
|
|
|
- position: relative;
|
|
|
- width: 18%;
|
|
|
- margin-right: 8upx;
|
|
|
- margin-bottom: 6upx;
|
|
|
- height: 70upx;
|
|
|
- & .img {
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- .shop-info_price {
|
|
|
- position: absolute;
|
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
|
|
- bottom: 0;
|
|
|
- width: 100%;
|
|
|
- font-size: 12upx;
|
|
|
- color: #ffffff;
|
|
|
- height:25upx;
|
|
|
- & > view {
|
|
|
- font-size: 10upx;
|
|
|
- & > view:nth-child(1) {
|
|
|
- overflow: hidden;
|
|
|
- text-overflow:ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- width:90%;
|
|
|
- }
|
|
|
- & > view:nth-child(2) {
|
|
|
- font-size:8upx;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
& .shop-footer_box {
|
|
|
height: 40upx;
|