Selaa lähdekoodia

供需搜索和分页加载

zhaoxiaohai 3 vuotta sitten
vanhempi
commit
49ea78e79e

+ 2 - 1
app.json

@@ -62,7 +62,8 @@
         "pages/tabbar-pages/liveBroadcast/index",
         "pages/tabbar-pages/home/analysis/index",
         "pages/tabbar-pages/home/release/index",
-        "pages/tabbar-pages/home/analysis/detalis"
+        "pages/tabbar-pages/home/analysis/detalis",
+        "pages/tabbar-pages/user/mySupplyAndDemand/index"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",

+ 10 - 1
components/My_MultipleChoice/index.js

@@ -24,6 +24,10 @@ Component({
         type: {
             type: String,
             value: 'mr'
+        },
+        isAll: {
+            type: Boolean,
+            value: false
         }
     },
     lifetimes: {
@@ -55,6 +59,11 @@ Component({
             };
             _Http.basic(data).then(res => {
                 console.log(res)
+                if (this.data.isAll) res.data.unshift({
+                    attinfos: [],
+                    ftype: '全部',
+                    ttypedetailid: 0
+                })
                 this.returnClassify(res);
             })
         },
@@ -98,7 +107,7 @@ Component({
             if (res.msg != "成功") return wx.showToast({
                 title: '数据加载失败,请重新进入页面',
                 icon: "none",
-                duration: 5000
+                duration: 3000
             })
             let dataList = []
             for (let i = 0; i < res.data.length; i++) {

+ 21 - 3
components/My_Search/index.js

@@ -4,7 +4,16 @@ Component({
      * 组件的属性列表
      */
     properties: {
-
+        checked: {
+            type: String,
+            value: '全部'
+        },
+        showPop: {
+            type: Function
+        },
+        searchContent: {
+            type: Function
+        }
     },
 
     /**
@@ -18,6 +27,15 @@ Component({
      * 组件的方法列表
      */
     methods: {
-
+        /* 选择分类 */
+        selected() {
+            this.triggerEvent("showPop")
+        },
+        /* 搜索 */
+        onSearch({
+            detail
+        }) {
+            this.triggerEvent('searchContent', detail.trim());
+        }
     }
-})
+})

+ 2 - 2
components/My_Search/index.wxml

@@ -1,7 +1,7 @@
 <!-- 搜索 -->
 <view class="home-search">
-    <view class="search-type">全部</view>
+    <view class="search-type" bindtap="selected">{{checked}}</view>
     <view class="search-box">
-        <van-search field-class='search-class' input-class='inputClass' shape='round' value="{{ value }}" placeholder="请输入搜索关键词" />
+        <van-search field-class='search-class' input-class='inputClass' shape='round' value="{{ value }}" bind:search="onSearch" clearable='{{false}}' placeholder="请输入搜索关键词" />
     </view>
 </view>

+ 52 - 9
pages/tabbar-pages/home/analysis/index.js

@@ -15,7 +15,12 @@ Page({
         line: 0, //显示列表下标
         active: 0, //tabs下标
         statisticsData: {}, //统计数据
-        isCanDraw: false
+        isCanDraw: false,
+        pageNumber: 1,
+        pageTotal: 1,
+        ftype: '全部',
+        condition: '',
+        typePopShow: false,
     },
 
     /**
@@ -47,31 +52,66 @@ Page({
                 }]
             })
         });
-        /* 获取我的供需 */
+        this.query_mysupplyanddemandList()
+
+    },
+    /* 选择分类 */
+    typeCallBack({
+        detail
+    }) {
+        if (detail == this.data.ftype || detail == '') return this.typePopChange()
+        this.setData({
+            pageNumber: 1,
+            condition: '',
+            ftype: detail,
+            typePopShow: false
+        })
+        this.query_mysupplyanddemandList();
+    },
+    /* 弹出层控制 */
+    typePopChange() {
+        this.setData({
+            typePopShow: !this.data.typePopShow
+        })
+    },
+    searchContent({
+        detail
+    }) {
+        if (this.data.condition == detail) return;
+        this.setData({
+            pageNumber: 1,
+            pageTotal: 1,
+            condition: detail
+        })
+        this.query_mysupplyanddemandList()
+    },
+    /* 获取我的供需 */
+    query_mysupplyanddemandList() {
+        if (this.data.pageNumber > this.data.pageTotal) return;
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.supplyanddemand.supplyanddemand",
             "method": "query_mysupplyanddemandList",
             "content": {
                 "getdatafromdbanyway": true,
-                "pageNumber": 1,
+                "pageNumber": this.data.pageNumber,
                 "pageSize": 20,
                 "where": {
-                    "condition": '',
-                    "ftype": "",
+                    "condition": this.data.condition,
+                    "ftype": (this.data.ftype == '全部') ? '' : this.data.ftype,
                     "fissupply": "0"
                 }
             }
         }).then(res => {
-            console.log(res)
             if (res.msg != "成功") return wx.showToast({
                 title: res.data,
             })
-            const data = handleList.getYTD(res.data);
+            let data = (res.data.length > 0) ? handleList.getYTD(res.data) : [];
+            (res.pageNumber == 1) ? '' : data = this.data.productList.concat(data);
             this.setData({
                 productList: data
             })
-            this.getsupplyanddemandLogTop10(0)
+            if (res.pageNumber == 1) this.getsupplyanddemandLogTop10(0);
         })
     },
 
@@ -184,7 +224,10 @@ Page({
      * 页面上拉触底事件的处理函数
      */
     onReachBottom() {
-
+        this.setData({
+            pageNumber: this.data.pageNumber + 1
+        })
+        this.query_mysupplyanddemandList()
     },
 
     /**

+ 2 - 1
pages/tabbar-pages/home/analysis/index.json

@@ -2,6 +2,7 @@
     "usingComponents": {
         "My_Search": "/components/My_Search/index",
         "UserMsg": "./UserMsg/index",
-        "share-box": "./shareBox/index"
+        "share-box": "./shareBox/index",
+        "My_MultipleChoice": "/components/My_MultipleChoice/index"
     }
 }

+ 6 - 1
pages/tabbar-pages/home/analysis/index.wxml

@@ -8,7 +8,11 @@
     </view>
 </view>
 <!-- 搜索 -->
-<My_Search></My_Search>
+<My_Search checked='{{ftype}}' bindshowPop='typePopChange' bindsearchContent='searchContent' />
+<!-- 搜索分类选择 -->
+<van-popup show="{{ typePopShow }}" position='bottom' z-index='9999999999999' bind:close="typePopChange">
+    <My_MultipleChoice isAll='{{true}}' pitchOnItem='{{ftype}}' bindoptionChange='typeCallBack' />
+</van-popup>
 <!-- 列表 -->
 <view class="item-box" wx:for="{{productList}}" wx:key="index">
     <view class="head" data-item='{{item}}' bindtap="toDetalis">
@@ -44,5 +48,6 @@
         </van-tabs>
     </view>
 </view>
+<van-empty wx:if="{{productList.length==0}}" description="暂无内容" />
 <!-- 分享图片 -->
 <share-box isCanDraw="{{isCanDraw}}" drawMsg='{{drawMsg}}' bind:initData="handleClose" />

+ 43 - 5
pages/tabbar-pages/home/index.js

@@ -36,10 +36,22 @@ Page({
         /* 分页 */
         pageNumber: 1,
         pageTotal: 1,
-        ftype: "",
-        condition: ""
+        ftype: "全部",
+        condition: "",
+        typePopShow: false,
+    },
+    /* 搜索内容 */
+    searchContent({
+        detail
+    }) {
+        if (this.data.condition == detail) return;
+        this.setData({
+            pageNumber: 1,
+            pageTotal: 1,
+            condition: detail
+        })
+        this.supplyanddemandList()
     },
-
     /* 宫格区跳转 */
     gridJumpPage(e) {
         const {
@@ -77,7 +89,6 @@ Page({
             })
         }
     },
-
     /* 获取最新供需列表 */
     supplyanddemandList() {
         if (this.data.pageNumber > this.data.pageTotal) return;
@@ -90,7 +101,7 @@ Page({
                 "pageSize": this.data.pageNumber == 1 ? 10 : 20,
                 "siteid": "BWJ",
                 "where": {
-                    "ftype": this.data.ftype,
+                    "ftype": (this.data.ftype == '全部') ? "" : this.data.ftype,
                     "condition": this.data.condition,
                     "fissupply": "0",
                     "fstatus": "待对接"
@@ -110,9 +121,15 @@ Page({
                     productList,
                     pageTotal: res.pageTotal
                 });
+            } else {
+                wx.showToast({
+                    title: '未搜索到相关内容',
+                    icon: "none"
+                })
             }
         });
     },
+
     /**
      * 生命周期函数--监听页面加载
      */
@@ -157,6 +174,7 @@ Page({
             })
         }
     },
+
     /* 二维码操作 */
     ifQrCodeType(data) {
         if (!wx.getStorageSync('userData')) return;
@@ -234,6 +252,26 @@ Page({
             });
         }
     },
+
+    /* 选择分类 */
+    typeCallBack({
+        detail
+    }) {
+        if (detail == this.data.ftype || detail == '') return this.typePopChange()
+        this.setData({
+            pageNumber: 1,
+            condition: '',
+            ftype: detail,
+            typePopShow: false
+        })
+        this.supplyanddemandList();
+    },
+    /* 弹出层控制 */
+    typePopChange() {
+        this.setData({
+            typePopShow: !this.data.typePopShow
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 7 - 6
pages/tabbar-pages/home/index.json

@@ -1,8 +1,9 @@
 {
-  "navigationStyle": "custom",
-  "usingComponents": {
-    "CusTabBar": "/custom-tab-bar/index",
-    "My_SupplyAndDemandList":"/components/My_SupplyAndDemandList/index",
-    "My_Search":"/components/My_Search/index"
-  }
+    "navigationStyle": "custom",
+    "usingComponents": {
+        "CusTabBar": "/custom-tab-bar/index",
+        "My_SupplyAndDemandList": "/components/My_SupplyAndDemandList/index",
+        "My_Search": "/components/My_Search/index",
+        "My_MultipleChoice": "/components/My_MultipleChoice/index"
+    }
 }

+ 5 - 1
pages/tabbar-pages/home/index.wxml

@@ -9,7 +9,11 @@
     </van-grid>
 </view>
 <!-- 搜索 -->
-<My_Search></My_Search>
+<My_Search checked='{{ftype}}' bindshowPop='typePopChange' bindsearchContent='searchContent' />
+<!-- 搜索分类选择 -->
+<van-popup show="{{ typePopShow }}" position='bottom' z-index='9999999999999' bind:close="typePopChange">
+    <My_MultipleChoice isAll='{{true}}' pitchOnItem='{{ftype}}' bindoptionChange='typeCallBack' />
+</van-popup>
 <!-- 供需列表 -->
 <My_SupplyAndDemandList list="{{productList}}" bind:shareCallBack='shareCallBack' />
 <!-- 占位 -->

+ 1 - 1
pages/tabbar-pages/home/release/index.wxml

@@ -32,7 +32,7 @@
 <van-action-sheet show="{{ popups }}" bind:close="showPop">
     <My_MultipleChoice title="需求分类"  pitchOnItem="{{ftype}}" bind:optionChange="radioChange" />
 </van-action-sheet>
-<view>{{tposition}}</view>
+
 <!-- 提交按钮 -->
 <view class="submit_but">
     <van-button bindtap="submit" custom-class="custom-class" round color="linear-gradient(180deg, #82E0E9 0%, #4BBECF 100%);">发 布</van-button>

+ 27 - 0
pages/tabbar-pages/home/sdDetalis.js

@@ -74,6 +74,33 @@ Page({
             phoneNumber: e.currentTarget.dataset.phone
         })
     },
+    toLinkUp(e) {
+        const {
+            tsupplyanddemandid,
+            tenterprise_userid
+        } = this.data.detalis;
+        if (tenterprise_userid == wx.getStorageSync('userData').userid) return wx.showToast({
+            title: '无法与自己对话',
+            icon: "none"
+        })
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.supplyanddemand.supplyanddemand",
+            "method": "OpenImDialog",
+            "content": {
+                "tsupplyanddemandid": tsupplyanddemandid
+            }
+        }).then(res => {
+            console.log("创建聊天", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            wx.navigateTo({
+                url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
+            })
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 1 - 1
pages/tabbar-pages/home/sdDetalis.wxml

@@ -12,7 +12,7 @@
         </view>
         <view>
             <van-button custom-class='v-but' style="margin-right: 16rpx;" color='#00C1D2' data-phone="{{detalis.fphonenumber}}" catchtap="callUp">电话联系</van-button>
-            <van-button custom-class='v-but' color='#FFB600'>在线联系</van-button>
+            <van-button custom-class='v-but' bindtap="toLinkUp" color='#FFB600'>在线联系</van-button>
         </view>
     </view>
 </van-sticky>

+ 2 - 108
pages/tabbar-pages/supplyAndDemand/index.js

@@ -72,19 +72,7 @@ Page({
             swiperBannerList: bannerList[0].banner
         });
     },
-    //跳转聊天
-    toLinkUpPage(e) {
-        const {
-            timdialogid,
-            fdatastatus
-        } = e.currentTarget.dataset;
-        this.setData({
-            ifShowCommunicationOfNumber: false
-        })
-        wx.navigateTo({
-            url: '/pages/chatRoom/dialogbox?id=' + timdialogid + '&fdatastatus=' + fdatastatus,
-        })
-    },
+
     /* tabs切换接口 */
     getList() {
         if (this.data.active == 0) return this.getSupplyAndDemand();
@@ -126,49 +114,7 @@ Page({
             'tabbarList[3].fcount': getApp().globalData.msgFcount
         })
     },
-    /* 显示沟通数量 */
-    showCommunicationOfNumber(e) {
-        let {
-            item
-        } = e.currentTarget.dataset;
-        let imdialogs = [];
-        _Http.basic({
-            "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.supplyanddemand.supplyanddemand",
-            "method": "query_mysupplyanddemandMain",
-            "content": {
-                "tsupplyanddemandid": item.tsupplyanddemandid
-            }
-        }, false).then(res => {
-            console.log('沟通列表', res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            imdialogs = res.data[0].imdialogs;
-            if (imdialogs.length != 0) {
-                for (let i = 0; i < imdialogs.length; i++) {
-                    let checkdate = imdialogs[i].createdate;
-                    if (checkdate != null && checkdate != undefined) imdialogs[i].createdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
-                }
-                this.setData({
-                    ifShowCommunicationOfNumber: true,
-                    imdialogs
-                })
-            } else {
-                wx.showToast({
-                    title: '暂无对话信息',
-                    icon: "none"
-                })
-            }
-        })
 
-    },
-    endShowCommunicationOfNumber() {
-        this.setData({
-            ifShowCommunicationOfNumber: false
-        })
-    },
     postDemand() {
         wx.navigateTo({
             url: '/pages/announceDemand/index',
@@ -178,33 +124,6 @@ Page({
     stop() {
         /* 所有供需列表中,已过期或已解决 不做操作 */
     },
-    toLinkUp(e) {
-        const {
-            tsupplyanddemandid,
-            tenterprise_userid
-        } = e.currentTarget.dataset.item;
-        if (tenterprise_userid == wx.getStorageSync('userData').userid) return wx.showToast({
-            title: '无法与自己对话',
-            icon: "none"
-        })
-        _Http.basic({
-            "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.supplyanddemand.supplyanddemand",
-            "method": "OpenImDialog",
-            "content": {
-                "tsupplyanddemandid": tsupplyanddemandid
-            }
-        }).then(res => {
-            console.log("创建聊天", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            wx.navigateTo({
-                url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
-            })
-        })
-    },
     /* 供需下架 */
     soldOut(e) {
         const that = this;
@@ -285,16 +204,6 @@ Page({
         this.InitializeDataPaging();
         this.getList();
     },
-    /* 跳转商品详情页 */
-    jumpForDetails(e) {
-        const {
-            index
-        } = e.currentTarget.dataset,
-            id = this.data.productList[index].tsupplyanddemandid;
-        wx.navigateTo({
-            url: '/pages/tabbar-pages/supplyAndDemand/particulars?tsupplyanddemandid=' + id + '&type=' + this.data.active,
-        })
-    },
     /* 我的需求 */
     myNeed() {
         //全部加载完成退出请求
@@ -332,16 +241,6 @@ Page({
             pageTotal: res.pageTotal,
         });
     },
-    /* 我的需求编辑按钮跳转 */
-    productEdit(e) {
-        const {
-            index
-        } = e.currentTarget.dataset
-        const data = JSON.stringify(this.data.productList[index])
-        wx.navigateTo({
-            url: '/pages/announceDemand/index?data=' + data,
-        })
-    },
     /* 我的需求搜索框获得焦点 */
     needSearchFocus() {
         this.setData({
@@ -383,12 +282,7 @@ Page({
             isOnShow: true
         })
     },
-    /* 阻止刷新列表 */
-    stopOnShow() {
-        this.setData({
-            isOnShow: false
-        })
-    },
+
 
     /**
      * 生命周期函数--监听页面卸载

+ 0 - 187
pages/tabbar-pages/supplyAndDemand/index.wxss

@@ -1,50 +1,4 @@
-/* 我的需求搜索框 */
-.my-need-search {
-    display: flex;
-    width: 702rpx;
-    height: 60rpx;
-    border-radius: 6rpx;
-    margin: 10rpx auto 20rpx;
-}
 
-.my-need-search-input {
-    flex: 1;
-    height: 100%;
-    line-height: 100%;
-    font-size: 26rpx;
-    text-align: center;
-    background-color: #FFFFFF;
-    color: rgba(0, 0, 0, 0.4);
-    border: 2px solid rgba(0, 0, 0, 0.1);
-    border-right: 0;
-    border-radius: 6rpx 0px 0px 6rpx;
-    padding-left: 20rpx;
-    margin-left: 10rpx;
-    box-sizing: border-box;
-}
-
-.my-need-search-inputfocus {
-    border: 2px solid #4DC2D4;
-    color: rgba(0, 0, 0, 0.7);
-}
-
-.my-need-search-but {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    width: 128rpx;
-    height: 100%;
-    font-size: 34rpx;
-    color: #FFFFFF;
-    background: #4DC2D4;
-    border-radius: 0px 6rpx 6rpx 0px;
-}
-
-
-
-.tabs_box {
-    width: 100vw;
-}
 
 /* tabs选中项样式 */
 .tabs-active-class {
@@ -53,57 +7,10 @@
     font-weight: 600 !important;
 }
 
-/* 下架按钮插槽样式 */
-.soldOutBut {
-    width: 76rpx !important;
-    height: 45rpx !important;
-    background: rgba(77, 194, 212, 0.1) !important;
-    box-shadow: 0px 0px 12rpx 0px rgba(0, 0, 0, 0.1) !important;
-    border-radius: 10rpx !important;
-    border: 2rpx solid #4DC2D4 !important;
-    padding: 0 !important;
-}
-
-/* 数据,按钮 插槽样式 */
-.dataAndBut {
-    display: flex;
-    justify-content: space-between !important;
-    align-items: center;
-    flex-wrap: nowrap;
-    margin-top: 14rpx;
-}
 
-.dataAndBut_data {
-    flex: 1;
-    display: flex;
-    font-size: 24rpx;
-    color: #000000;
-    margin-left: 16rpx;
-}
 
-.dataAndBut_data>text {
-    color: #4DC2D4;
-    text-decoration: underline;
-    margin-left: 8rpx;
-}
 
-/* 按钮 */
-.dataAndBut_but {
-    display: flex;
-    align-items: center;
-    margin-right: 6rpx;
-}
 
-.custom-slotBut {
-    height: 44rpx !important;
-    font-size: 20rpx !important;
-    background: linear-gradient(180deg, #84E3EC 0%, #4DC2D4 100%) !important;
-    box-shadow: 0px 0px 12rpx 0px rgba(0, 0, 0, 0.1) !important;
-    border-radius: 10rpx !important;
-    padding: 0 !important;
-    border: 0 !important;
-    width: 108rpx;
-}
 
 .custom-NoSlotBut {
     height: 44rpx !important;
@@ -178,97 +85,3 @@
     top: 0;
     left: 13rpx;
 }
-
-/* 宫格区域盒子 */
-.grid_box {
-    display: flex;
-    flex-wrap: wrap;
-    width: 704rpx;
-    background: #FFFFFF;
-    border-radius: 20rpx;
-    margin: 10rpx auto 20rpx;
-    padding: 30rpx 50rpx 0;
-    box-sizing: border-box;
-}
-
-.grid_item {
-    display: flex;
-    align-items: center;
-    flex-direction: column;
-    justify-content: space-between;
-    width: 130rpx;
-    margin-bottom: 20rpx;
-    padding: 0 11rpx;
-}
-
-
-.grid_item_image {
-    width: 80rpx;
-    height: 80rpx;
-    margin-bottom: 10rpx;
-    box-sizing: border-box;
-}
-
-.grid_item_image image {
-    width: 100%;
-    height: 100%;
-}
-
-.grid_item_title {
-    width: 100%;
-    text-align: center;
-    font-size: 24rpx;
-    color: #000000;
-}
-
-
-/* 沟通列表 */
-.CommunicationOfNumber {
-    padding-bottom: 30rpx;
-    max-height: 50vh;
-}
-
-.CommunicationOfNumber-title {
-    font-size: 32rpx;
-    font-weight: 500;
-    color: #000000;
-    margin: 40rpx 0 30rpx 54rpx;
-}
-
-.CommunicationOfNumber-list>view {
-    width: 100%;
-    padding: 0 20rpx;
-    font-size: 24rpx;
-    color: #000000;
-    margin-bottom: 20rpx;
-    box-sizing: border-box;
-}
-
-.CommunicationOfNumber-list .text {
-    color: #4DC2D4;
-    padding: 0 8rpx;
-}
-
-/* 我的供需 状态 */
-.myState {
-    height: 40rpx;
-}
-
-.myShowState {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    position: absolute;
-    width: 108rpx;
-    height: 44rpx;
-    background-color: #A7A8A8;
-    border-radius: 20rpx 0px 20rpx 0px;
-    top: 0;
-    left: 0;
-    font-size: 20rpx;
-    color: #FFFFFF;
-}
-
-.myNoSoldOut {
-    background: #4DC2D4;
-}

+ 8 - 1
pages/tabbar-pages/user/index.js

@@ -3,7 +3,6 @@ import {
 } from "../../../utils/api";
 const _Http = new ApiModel();
 Page({
-
     /**
      * 页面的初始数据
      */
@@ -26,6 +25,10 @@ Page({
             id: '004',
             text: '团队管理',
             icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-01.png'
+        }, {
+            id: '005',
+            text: '我的需求',
+            icon: 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/icon-01.png'
         }],
         userMessage: {}, //用户信息
         myShowModel: false, //显示弹出窗
@@ -85,6 +88,10 @@ Page({
             wx.navigateTo({
                 url: '/pages/businessPartner/index'
             })
+        } else if (name == '我的需求') {
+            wx.navigateTo({
+                url: '/pages/tabbar-pages/user/mySupplyAndDemand/index'
+            })
         }
     },
     /* 跳转用户信息 */

+ 1 - 1
pages/tabbar-pages/user/index.wxml

@@ -28,7 +28,7 @@
     </view>
     <!-- 宫格 -->
     <view class="grid_box">
-        <van-grid border="{{false}}" icon-size='40' bindtap="gridJumpPage">
+        <van-grid border="{{false}}" column-num="5" icon-size='40' bindtap="gridJumpPage">
             <van-grid-item wx:for="{{gridList}}" data-name="{{item.text}}" icon="{{item.icon}}" text="{{item.text}}" text-class="grid_text-class" />
         </van-grid>
     </view>

+ 1 - 1
pages/tabbar-pages/user/index.wxss

@@ -79,7 +79,7 @@
 
 .grid_text-class {
     height: 40rpx;
-    font-size: 28rpx !important;
+    font-size: 24rpx !important;
     font-family: PingFangSC-Regular, PingFang SC;
     color: #333333 !important;
     line-height: 40rpx;

+ 194 - 0
pages/tabbar-pages/user/mySupplyAndDemand/index.js

@@ -0,0 +1,194 @@
+import {
+    ApiModel
+} from '../../../../utils/api';
+const _Http = new ApiModel()
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        pageNumber: 1,
+        pageTotal: 1,
+        ftype: '',
+        condition: '',
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        this.query_mysupplyanddemandList()
+    },
+    onSearch({
+        detail
+    }) {
+        if (detail.trim() == this.data.condition) return;
+        this.setData({
+            pageNumber: 1,
+            pageTotal: 1,
+            condition: detail.trim()
+        })
+        this.query_mysupplyanddemandList()
+    },
+    onClear() {
+        if (this.data.condition == '') return;
+        this.setData({
+            condition: ''
+        })
+        this.query_mysupplyanddemandList()
+    },
+    query_mysupplyanddemandList() {
+        if (this.data.pageNumber > this.data.pageTotal) return;
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.supplyanddemand.supplyanddemand",
+            "method": "query_mysupplyanddemandList",
+            "content": {
+                "getdatafromdbanyway": true,
+                "pageNumber": this.data.pageNumber,
+                "pageSize": 20,
+                "where": {
+                    "condition": this.data.condition,
+                    "ftype": this.data.ftype,
+                    "fissupply": "0"
+                }
+            }
+        }).then(res => {
+            console.log("我的供需列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                productList: (res.pageNumber == 1) ? res.data : this.data.productList.concat(res.data),
+                pageTotal: res.pageTotal
+            })
+        })
+    },
+    /* 跳转商品详情页 */
+    jumpForDetails(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: '/pages/tabbar-pages/home/sdDetalis?item=' + JSON.stringify(item)
+        });
+    },
+    /* 显示沟通数量 */
+    showCommunicationOfNumber(e) {
+        let {
+            item
+        } = e.currentTarget.dataset;
+        let imdialogs = [];
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.supplyanddemand.supplyanddemand",
+            "method": "query_mysupplyanddemandMain",
+            "content": {
+                "tsupplyanddemandid": item.tsupplyanddemandid
+            }
+        }, false).then(res => {
+            console.log('沟通列表', res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            imdialogs = res.data[0].imdialogs;
+            if (imdialogs.length != 0) {
+                for (let i = 0; i < imdialogs.length; i++) {
+                    let checkdate = imdialogs[i].createdate;
+                    if (checkdate != null && checkdate != undefined) imdialogs[i].createdate = checkdate.slice(0, checkdate.lastIndexOf('.'));
+                }
+                this.setData({
+                    ifShowCommunicationOfNumber: true,
+                    imdialogs
+                })
+            } else {
+                wx.showToast({
+                    title: '暂无对话信息',
+                    icon: "none"
+                })
+            }
+        })
+    },
+    endShowCommunicationOfNumber() {
+        this.setData({
+            ifShowCommunicationOfNumber: false
+        })
+    },
+    //跳转聊天
+    toLinkUpPage(e) {
+        const {
+            timdialogid,
+            fdatastatus
+        } = e.currentTarget.dataset;
+        this.setData({
+            ifShowCommunicationOfNumber: false
+        })
+        wx.navigateTo({
+            url: '/pages/chatRoom/dialogbox?id=' + timdialogid + '&fdatastatus=' + fdatastatus,
+        })
+    },
+    /* 我的需求编辑按钮跳转 */
+    productEdit(e) {
+        const {
+            index
+        } = e.currentTarget.dataset
+        const data = JSON.stringify(this.data.productList[index])
+        wx.navigateTo({
+            url: '/pages/tabbar-pages/home/release/index?data=' + data,
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+        this.setData({
+            pageNumber: this.data.pageNumber + 1
+        })
+        this.query_mysupplyanddemandList()
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 6 - 0
pages/tabbar-pages/user/mySupplyAndDemand/index.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "My_SupplyAndDemandItemBox":"/components/My_SupplyAndDemandItemBox/index",
+        "van-search": "@vant/weapp/search/index"
+    }
+}

+ 43 - 0
pages/tabbar-pages/user/mySupplyAndDemand/index.wxml

@@ -0,0 +1,43 @@
+<!-- 搜索 -->
+<van-search value="{{ value }}" shape="round" background="#F6F7F8" custom-class='field-class' bind:search='onSearch' bind:clear='onClear' placeholder="请输入搜索关键词" />
+<!-- 列表 -->
+<My_SupplyAndDemandItemBox wx:for="{{productList}}" wx:key="index" title="【{{item.ftype}}】{{item.ftitle}}" time="{{item.checkdate}}" imageList="{{item.attinfos}}" data-item="{{item}}" bindtap="jumpForDetails" type='{{item.ftype}}' content="{{item.fcontent}}">
+    <!-- 我的需求左上状态插槽 -->
+    <view slot="myState" class="myState">
+        <view class="myShowState {{item.fstatus=='正在对接'?'myNoSoldOut':''}}{{item.fstatus=='对接中'?'myNoSoldOut':''}} {{item.fstatus=='待对接'?'myNoSoldOut':''}}">
+            <view wx:if="{{item.fstatus=='已解决'}}">已下架</view>
+            <view wx:elif="{{item.fstatus=='新建'}}">未上架</view>
+            <view wx:elif="{{item.fstatus=='待对接'}}">上架中</view>
+            <view wx:elif="{{item.fstatus=='对接中'}}">对接中</view>
+            <view wx:elif="{{item.fstatus=='正在对接'}}">对接中</view>
+            <view wx:else>已下架</view>
+        </view>
+    </view>
+    <!-- 下架按钮插槽 -->
+    <view slot="soldOutBut">
+        <van-button data-index="{{index}}" plain color="#4DC2D4" custom-class="soldOutBut" catchtap="soldOut">下架</van-button>
+    </view>
+    <!-- 内容信息插槽 -->
+    <view slot="dataAndBut">
+        <view class="dataAndBut">
+            <view class="dataAndBut_data">
+                浏览次数:{{item.freadtimes}} 沟通人数:{{item.fcommunicationtimes}}次
+            </view>
+            <view class="dataAndBut_but">
+                <van-button color="#4DC2D4" data-item="{{item}}" style="margin-left: 16rpx;" custom-class="custom-slotBut" catchtap="showCommunicationOfNumber">沟通详情</van-button>
+                <van-button color="#4DC2D4" data-index="{{index}}" style="margin-left: 16rpx;" custom-class="custom-slotBut" catchtap="productEdit">编辑</van-button>
+            </view>
+        </view>
+    </view>
+</My_SupplyAndDemandItemBox>
+<van-empty wx:if="{{productList.length==0}}" description="暂无内容" />
+<!-- 我的需求弹框 -->
+<van-action-sheet show="{{ ifShowCommunicationOfNumber }}" bind:close="endShowCommunicationOfNumber">
+    <view class="CommunicationOfNumber">
+        <view class="CommunicationOfNumber-title">沟通列表</view>
+        <view class="CommunicationOfNumber-list">
+            <view wx:for="{{imdialogs}}" wx:key="index">{{item.createdate}}<text data-timdialogid="{{item.timdialogid}}" data-fdatastatus="{{item.fdatastatus}}" catchtap="toLinkUpPage" class="text">用户:{{item.fname}}</text><text wx:if="{{item.fdatastatus==0}}">发起联系,遗憾未达成合作</text><text wx:elif='{{item.fdatastatus==1}}'>发起联系,恭喜达成合作</text><text wx:else>发起联系,正在对接中</text></view>
+        </view>
+    </view>
+    <view style="height: 35px;"></view>
+</van-action-sheet>

+ 108 - 0
pages/tabbar-pages/user/mySupplyAndDemand/index.wxss

@@ -0,0 +1,108 @@
+/* 沟通列表 */
+.CommunicationOfNumber {
+    padding-bottom: 30rpx;
+    max-height: 50vh;
+}
+
+.CommunicationOfNumber-title {
+    font-size: 32rpx;
+    font-weight: 500;
+    color: #000000;
+    margin: 40rpx 0 30rpx 54rpx;
+}
+
+.CommunicationOfNumber-list>view {
+    width: 100%;
+    padding: 0 20rpx;
+    font-size: 24rpx;
+    color: #000000;
+    margin-bottom: 20rpx;
+    box-sizing: border-box;
+}
+
+.CommunicationOfNumber-list .text {
+    color: #4DC2D4;
+    padding: 0 8rpx;
+}
+
+/* 我的供需 状态 */
+.myState {
+    height: 40rpx;
+}
+
+.myShowState {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    position: absolute;
+    width: 108rpx;
+    height: 44rpx;
+    background-color: #A7A8A8;
+    border-radius: 20rpx 0px 20rpx 0px;
+    top: 0;
+    left: 0;
+    font-size: 20rpx;
+    color: #FFFFFF;
+}
+
+.myNoSoldOut {
+    background: #4DC2D4;
+}
+
+/* 按钮 */
+.dataAndBut_but {
+    display: flex;
+    align-items: center;
+    margin-right: 6rpx;
+}
+
+.custom-slotBut {
+    height: 44rpx !important;
+    font-size: 20rpx !important;
+    background: linear-gradient(180deg, #84E3EC 0%, #4DC2D4 100%) !important;
+    box-shadow: 0px 0px 12rpx 0px rgba(0, 0, 0, 0.1) !important;
+    border-radius: 10rpx !important;
+    padding: 0 !important;
+    border: 0 !important;
+    width: 108rpx;
+}
+
+
+/* 数据,按钮 插槽样式 */
+.dataAndBut {
+    display: flex;
+    justify-content: space-between !important;
+    align-items: center;
+    flex-wrap: nowrap;
+    margin-top: 14rpx;
+}
+
+.dataAndBut_data {
+    flex: 1;
+    display: flex;
+    font-size: 24rpx;
+    color: #000000;
+    margin-left: 16rpx;
+}
+
+.dataAndBut_data>text {
+    color: #4DC2D4;
+    text-decoration: underline;
+    margin-left: 8rpx;
+}
+
+/* 下架按钮插槽样式 */
+.soldOutBut {
+    width: 76rpx !important;
+    height: 45rpx !important;
+    background: rgba(77, 194, 212, 0.1) !important;
+    box-shadow: 0px 0px 12rpx 0px rgba(0, 0, 0, 0.1) !important;
+    border-radius: 10rpx !important;
+    border: 2rpx solid #4DC2D4 !important;
+    padding: 0 !important;
+}
+
+/* 搜索框 */
+.van-search__content {
+    background-color: #FFFFFF !important;
+}

+ 14 - 0
project.private.config.json

@@ -37,6 +37,20 @@
                     "query": "",
                     "launchMode": "default",
                     "scene": null
+                },
+                {
+                    "name": "我的",
+                    "pathName": "pages/tabbar-pages/user/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "我的需求",
+                    "pathName": "pages/tabbar-pages/user/mySupplyAndDemand/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
                 }
             ]
         }