zhaoxiaohai 3 vuotta sitten
vanhempi
commit
9adfdfc3de

+ 38 - 4
pages/businessPartner/index.js

@@ -10,13 +10,29 @@ Page({
     data: {
         showIndex: -1, //显示按钮的下标
         cooperationList: [], //合作列表
+        condition: "", //模糊搜索条件
+        scrolltolowerThrottle: true, //下拉触底截流
+        pageNumber: 1, //请求分页
+        pageTotal: 1, //总页数
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
+    onLoad: function (options) {},
+    /* 搜索 */
+    searchQuery({
+        detail
+    }) {
+        if (this.data.condition == detail) return;
+        this.setData({
+            condition: detail,
+            pageNumber: 1,
+            pageTotal: 1
+        })
+        this.getList();
     },
+    /* 点击item */
     showBtnIndex(e) {
         const {
             index
@@ -43,27 +59,45 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
+        this.setData({
+            pageNumber: 1,
+            pageTotal: 1
+        });
+        this.getList()
+    },
+    scrolltolower() {
+        if (!this.data.scrolltolowerThrottle) return;
+        this.setData({
+            scrolltolowerThrottle: false
+        })
+        if (this.data.pageTotal > this.data.pageNumber) this.getList();
+    },
+    getList() {
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.tagents.tagents",
             "method": "query_cooperation",
             "content": {
                 "getdatafromdbanyway": true,
-                "pageNumber": 1,
+                "pageNumber": this.data.pageNumber,
                 "pageSize": 20,
                 "where": {
-                    "condition": "",
+                    "condition": this.data.condition,
                     "ftype": "",
                     "fstatus": "合作"
                 }
             }
         }).then(res => {
+            console.log(res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
                 icon: "none"
             });
             this.setData({
-                cooperationList: res.data
+                cooperationList: res.data,
+                pageTotal: res.pageTotal,
+                pageNumber: this.data.pageNumber + 1,
+                scrolltolowerThrottle: true
             })
         })
     },

+ 15 - 12
pages/businessPartner/index.wxml

@@ -1,19 +1,22 @@
 <view class="SearchInputBox">
-    <My_SearchInputBox  inputColor="#D8D8D8" inputRadius="30" fisadministrator="{{true}}" butText="新合作" marTop="0" route="consociation"></My_SearchInputBox>
+    <My_SearchInputBox inputColor="#D8D8D8" inputRadius="30" fisadministrator="{{true}}" butText="新合作" marTop="0" route="consociation" bind:searchQuery="searchQuery"></My_SearchInputBox>
 </view>
 
 <My_DisplayBox title="商户列表" isMore="{{false}}">
     <image slot="display-box-img" class="display-title_image" src="/static/icon-05.png" mode="aspectFit"></image>
-    <view class="company-data" wx:for="{{cooperationList}}" data-index="{{index}}" bindtap="showBtnIndex">
-        <image class="company-data-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
-        <view class="company-data-text">
-            <view class="company-data-brandName">{{item.fbrand}}</view>
-            <view wx:if="{{item.ftype==1}}">合作方式:上游</view>
-            <view wx:if="{{item.ftype==2}}">合作方式:下游</view>
-            <view wx:if="{{item.ftype==3}}">合作方式:双向合作</view>
+    <scroll-view class="list-scroll-view" scroll-y bindscrolltolower="scrolltolower">
+        <view class="company-data" wx:for="{{cooperationList}}" data-index="{{index}}" bindtap="showBtnIndex">
+            <image class="company-data-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+            <view class="company-data-text">
+                <view class="company-data-brandName u-line-1">{{item.fbrand}}</view>
+                <view wx:if="{{item.ftype==1}}">合作方式:上游</view>
+                <view wx:if="{{item.ftype==2}}">合作方式:下游</view>
+                <view wx:if="{{item.ftype==3}}">合作方式:双向合作</view>
+            </view>
+            <view class="company-data-but">
+                <van-button wx:if="{{index==showIndex}}" custom-class="custom-class-company-data" catchtap="jumpForDetails">合作详情</van-button>
+            </view>
         </view>
-        <view class="company-data-but">
-            <van-button wx:if="{{index==showIndex}}" custom-class="custom-class-company-data" catchtap="jumpForDetails">合作详情</van-button>
-        </view>
-    </view>
+        <My_pageReachBottom loadMore="{{scrolltolowerThrottle==true}}" dummyStatus="{{cooperationList.length>1}}"></My_pageReachBottom>
+    </scroll-view>
 </My_DisplayBox>

+ 6 - 0
pages/businessPartner/index.wxss

@@ -12,6 +12,11 @@
     margin: 0 6rpx;
 }
 
+.list-scroll-view{
+    width: 100%;
+    height: 79vh;
+}
+
 /* 相关商家信息 */
 .company-data {
     display: flex;
@@ -40,6 +45,7 @@
 }
 
 .company-data-brandName {
+    width: 300rpx;
     font-size: 28rpx;
     color: #000000;
 }