Explorar el Código

数据抓取ok

shish hace 4 años
padre
commit
ff1f65d20c
Se han modificado 1 ficheros con 25 adiciones y 10 borrados
  1. 25 10
      hdPad/src/admin/home/components/rightGoodsArea.vue

+ 25 - 10
hdPad/src/admin/home/components/rightGoodsArea.vue

@@ -3,8 +3,9 @@
         <view class="shop-type_box">
         <view class="shop-type_box">
             <view v-for="item in categoryData" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.categoryName}} </view>
             <view v-for="item in categoryData" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.categoryName}} </view>
         </view>
         </view>
-        <view class="shop-show_box">
-            <view v-for="item in goodsInfoList" :key="item.id" class="show-shop_box">
+        
+        <scroll-view lower-threshold="20" @scrolltolower="reachBottom" class="shop-show_box" :scroll-y="true">
+            <view v-for="item in list.data" :key="item.id" class="show-shop_box">
                 <view class="item-detail" @click="popAddModelFn(item)">
                 <view class="item-detail" @click="popAddModelFn(item)">
                     <image class="img" :src="item.cover" mode="scaleToFill" ></image>
                     <image class="img" :src="item.cover" mode="scaleToFill" ></image>
                     <view class="shop-info_price">
                     <view class="shop-info_price">
@@ -15,7 +16,8 @@
                     </view>
                     </view>
                 </view>
                 </view>
             </view>
             </view>
-        </view>
+        </scroll-view>
+        
         <slot name="footer"></slot>
         <slot name="footer"></slot>
 
 
         <!-- 开单选花材输入数量和金额 -->
         <!-- 开单选花材输入数量和金额 -->
@@ -30,16 +32,16 @@ import settlePop from './settle-pop.vue'
 import { getClass } from '@/api/category/index'
 import { getClass } from '@/api/category/index'
 import { getGoodsList } from '@/api/goods/index'
 import { getGoodsList } from '@/api/goods/index'
 import productMins from "@/mixins/product";
 import productMins from "@/mixins/product";
+import list from "@/mixins/list";
 import kdSelectNumPrice from '@/components/app-kd-select-num-price.vue'
 import kdSelectNumPrice from '@/components/app-kd-select-num-price.vue'
 export default {
 export default {
     name:'rightItemArea',
     name:'rightItemArea',
     components:{ settlePop,kdSelectNumPrice },
     components:{ settlePop,kdSelectNumPrice },
-	mixins: [productMins],
+	mixins: [productMins,list],
     data(){
     data(){
         return {
         return {
             categoryData:[],
             categoryData:[],
             categoryId: '',
             categoryId: '',
-            goodsInfoList:[],
             selectJobType:'bill',
             selectJobType:'bill',
             selectJobId:0
             selectJobId:0
         }
         }
@@ -72,23 +74,31 @@ export default {
                     this.categoryData = res.data
                     this.categoryData = res.data
                     this.categoryId = this.categoryData[0].id
                     this.categoryId = this.categoryData[0].id
                     this.getGoodsData()
                     this.getGoodsData()
-                    //this.initStorageData()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                    //this.initStorageData()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                 }
                 }
             })
             })
         },
         },
         getGoodsData(){
         getGoodsData(){
-            getGoodsList({cId:this.categoryId}).then(res=>{
+            getGoodsList({cId:this.categoryId,page:this.list.page}).then(res=>{
                 if(res.code == 1){
                 if(res.code == 1){
-                    this.goodsInfoList = res.data
+                    this.completes(res)
                 }
                 }
             })
             })
         },
         },
+        reachBottom(){
+            if (!this.list.finished) {
+                this.getGoodsData()
+            }
+        },
         changeCategory(item){
         changeCategory(item){
             this.$util.hitRemind()
             this.$util.hitRemind()
-            if(item.id === this.categoryId){
-                return false
+            if(this.categoryId != item.id){
+                this.list.data=[]
+                this.list.page = 1
+                this.list.finished = false
             }
             }
             this.categoryId = item.id
             this.categoryId = item.id
+            this.getGoodsData()
         }
         }
     }
     }
 }
 }
@@ -101,7 +111,12 @@ export default {
     flex-direction: column;
     flex-direction: column;
     box-sizing: border-box;
     box-sizing: border-box;
     & .shop-show_box{
     & .shop-show_box{
+        display: flex;
+        align-items: center;
         & .show-shop_box{
         & .show-shop_box{
+            width: 82upx;
+            height: 82upx;
+            background:red;
             & .item-detail{
             & .item-detail{
                 position: relative;
                 position: relative;
                 margin-right: 9upx;
                 margin-right: 9upx;