|
|
@@ -1,10 +1,9 @@
|
|
|
<template>
|
|
|
<view class="shop-listType_box">
|
|
|
<view class="cat-list-area">
|
|
|
- <view :class="[flower==0?'active':'']" @click="changeKind(0)">绿植盆栽</view>
|
|
|
- <view :class="[flower==1?'active':'']" @click="changeKind(1)">花束花篮</view>
|
|
|
+ <view v-for="item in classList" :key="item.id" :class="[item.id==selIndex ? 'active':'']" @click="changeMyClass(item)">{{item.categoryName}}</view>
|
|
|
</view>
|
|
|
- <view class="num-area" v-if="flower==1">
|
|
|
+ <view class="num-area">
|
|
|
<view v-for="info in flowerNumList" :class="[flowerNum===info.num?'selected':'']" @click="setNum(info)" :key="info.num">{{info.name}}</view>
|
|
|
</view>
|
|
|
<scroll-view class="shop-show_box" enable-flex="true" scroll-y="true" lower-threshold="20" @scrolltolower="reachBottom">
|
|
|
@@ -36,7 +35,8 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { getGoodsList } from '@/api/goods/index'
|
|
|
+import { getGoodsInfoList } from '@/api/goods'
|
|
|
+import { getAllClass } from '@/api/category'
|
|
|
import productMins from "@/mixins/product";
|
|
|
import list from "@/mixins/list";
|
|
|
import selectNumPrice from './selectNumPrice.vue'
|
|
|
@@ -52,7 +52,9 @@ export default {
|
|
|
flowerNum:0,
|
|
|
flower:0,
|
|
|
checkStock:true,
|
|
|
- flowerNumList:[{num:6,name:6},{num:9,name:9},{num:11,name:11},{num:19,name:19},{num:33,name:33},{num:52,name:52},{num:66,name:66},{num:99,name:99}]
|
|
|
+ flowerNumList:[{num:6,name:6},{num:9,name:9},{num:11,name:11},{num:19,name:19},{num:33,name:33},{num:52,name:52},{num:66,name:66},{num:99,name:99}],
|
|
|
+ classList:[],
|
|
|
+ selIndex:0
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
|
@@ -112,17 +114,25 @@ export default {
|
|
|
this.list.data=[]
|
|
|
this.list.page = 1
|
|
|
this.list.finished = false
|
|
|
- this.getGoodsData()
|
|
|
+ this.getShowData()
|
|
|
},
|
|
|
popAddModelFn(info) {
|
|
|
this.$util.hitVoice()
|
|
|
this.showAddModelFn({ ...info, currentNum: 1, unitPrice: info.price,unitType:0})
|
|
|
},
|
|
|
init(){
|
|
|
- this.getGoodsData()
|
|
|
+ getAllClass().then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.classList = res.data.list
|
|
|
+ if(!this.$util.isEmpty(this.classList)){
|
|
|
+ this.selIndex = this.classList[0].id
|
|
|
+ this.getShowData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- getGoodsData(){
|
|
|
- getGoodsList({page:this.list.page,pageSize:30,flowerNum:this.flowerNum,hasStock:1,flower:this.flower}).then(res=>{
|
|
|
+ getShowData(){
|
|
|
+ getGoodsInfoList({page:this.list.page,pageSize:30,cId:this.selIndex,flowerNum:this.flowerNum}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
this.completes(res)
|
|
|
}
|
|
|
@@ -130,17 +140,17 @@ export default {
|
|
|
},
|
|
|
reachBottom(){
|
|
|
if (!this.list.finished) {
|
|
|
- this.getGoodsData()
|
|
|
+ this.getShowData()
|
|
|
}
|
|
|
},
|
|
|
- changeKind(flower){
|
|
|
+ changeMyClass(item){
|
|
|
this.$util.hitVoice()
|
|
|
- this.flower = flower
|
|
|
+ this.selIndex = item.id
|
|
|
this.list.data=[]
|
|
|
this.list.page = 1
|
|
|
this.list.finished = false
|
|
|
this.flowerNum = 0
|
|
|
- this.getGoodsData()
|
|
|
+ this.getShowData()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -171,7 +181,7 @@ export default {
|
|
|
overflow: hidden;
|
|
|
white-space: nowrap;
|
|
|
&.active {
|
|
|
- background-color: #428369;
|
|
|
+ background-color: #09C567;
|
|
|
color: #ffffff;
|
|
|
}
|
|
|
}
|