zhaoxiaohai 3 år sedan
förälder
incheckning
b90ea4fe05

+ 4 - 3
app.json

@@ -61,7 +61,8 @@
         "pages/tabbar-pages/home/sdDetalis",
         "pages/tabbar-pages/liveBroadcast/index",
         "pages/tabbar-pages/home/analysis/index",
-        "pages/tabbar-pages/home/release/index"
+        "pages/tabbar-pages/home/release/index",
+        "pages/tabbar-pages/home/analysis/detalis"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",
@@ -108,7 +109,7 @@
     "debug": true,
     "permission": {
         "scope.userLocation": {
-          "desc": "你的位置信息将用于供需发布位置" 
+            "desc": "你的位置信息将用于供需发布位置"
         }
-      }
+    }
 }

+ 33 - 0
pages/tabbar-pages/home/analysis/UserMsg/index.js

@@ -0,0 +1,33 @@
+// pages/tabbar-pages/home/analysis/UserMsg/index.js
+Component({
+    options: {
+        addGlobalClass: true
+    },
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        list: Array,
+        item: Object,
+        index: Number
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 查看更多 */
+        viewMore() {
+            wx.navigateTo({
+                url: '/pages/tabbar-pages/home/analysis/detalis?item=' + JSON.stringify(this.data.item) + '&active=' + this.data.index,
+            })
+        },
+    }
+})

+ 4 - 0
pages/tabbar-pages/home/analysis/UserMsg/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 15 - 0
pages/tabbar-pages/home/analysis/UserMsg/index.wxml

@@ -0,0 +1,15 @@
+<view class="user-msg-box" wx:for="{{list}}" wx:key="index">
+    <view class="image">
+        <image wx:if="{{item.headportraiturl}}" src="{{item.headportraiturl}}" mode="aspectFill" />
+        <image wx:else src="https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/userImg.png" mode="aspectFill" />
+    </view>
+    <view class="content">
+        <view style="display: flex;">
+            <view class="u-line-1" style="max-width: 250rpx;">{{item.fname}}</view>{{item.fphonenumber!=null?'-'+item.fphonenumber:''}}
+        </view>
+        <view class="time">{{item.createdate}}</view>
+    </view>
+</view>
+<view wx:if="{{item&&list.length==10}}" class="even-more" bindtap="viewMore">
+    更多浏览>>
+</view>

+ 49 - 0
pages/tabbar-pages/home/analysis/UserMsg/index.wxss

@@ -0,0 +1,49 @@
+.user-msg-box {
+    display: flex;
+    align-items: center;
+    width: 690rpx;
+    height: 78rpx;
+    margin: 0 auto;
+    box-sizing: border-box;
+}
+
+.user-msg-box .image {
+    width: 50rpx;
+    height: 50rpx;
+    margin-right: 14rpx;
+    border-radius: 50%;
+    overflow: hidden;
+}
+
+.user-msg-box .image image {
+    width: 100%;
+    height: 100%;
+}
+
+.even-more {
+    height: 40rpx;
+    font-size: 28rpx;
+    color: #00C1D2;
+    line-height: 40rpx;
+    margin: 0 auto;
+    text-align: center;
+    padding-bottom: 20rpx;
+}
+
+.user-msg-box .content {
+    flex: 1;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    height: 100%;
+    border-top: 2rpx solid rgba(151, 151, 151, .1);
+}
+
+.user-msg-box .content>view {
+    font-size: 28rpx;
+    color: rgba(0, 0, 0, .9);
+}
+
+.user-msg-box .content .time {
+    color: rgba(51, 51, 51, .9);
+}

+ 126 - 0
pages/tabbar-pages/home/analysis/detalis.js

@@ -0,0 +1,126 @@
+import {
+    ApiModel
+} from '../../../../utils/api';
+const _Http = new ApiModel();
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        detalis: {},
+        active: 0,
+        pageNumber: 1,
+        pageTotal: 1
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        if (options.item) this.setData({
+            detalis: JSON.parse(options.item)
+        })
+        if (options.active) this.setData({
+            active: options.active-0
+        })
+        this.getsupplyanddemandLogList()
+    },
+
+    getsupplyanddemandLogList() {
+        if (this.data.pageTotal < this.data.pageNumber) return;
+        let ftype = null;
+        switch (this.data.active) {
+            case 0:
+                ftype = 3
+                break;
+            case 1:
+                ftype = 2
+                break;
+            case 2:
+                ftype = 1
+                break;
+        }
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.supplyanddemand.supplyanddemand",
+            "method": "getsupplyanddemandLogList",
+            "content": {
+                "tsupplyanddemandid": this.data.detalis.tsupplyanddemandid,
+                ftype,
+                "pageSize": 50,
+                "pageNumber": this.data.pageNumber
+            }
+        }).then(res => {
+            console.log(res)
+            if (res.data.length > 0)
+                for (let index = 0; index < res.data.length; index++) {
+                    res.data[index].createdate = res.data[index].createdate.slice(5, 16)
+                }
+            if (res.pageNumber != 1) res.data = this.data.statisticsData.concat(res.data)
+            this.setData({
+                statisticsData: res.data,
+                pageTotal: res.pageTotal
+            })
+        })
+    },
+
+    tabsOnChange(e) {
+        this.setData({
+            active: e.detail.index,
+            pageNumber: 1
+        })
+        this.getsupplyanddemandLogList();
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+        this.setData({
+            pageNumber: this.data.pageNumber + 1
+        });
+        this.getsupplyanddemandLogList();
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 5 - 0
pages/tabbar-pages/home/analysis/detalis.json

@@ -0,0 +1,5 @@
+{
+    "usingComponents": {
+        "UserMsg": "./UserMsg/index"
+    }
+}

+ 19 - 0
pages/tabbar-pages/home/analysis/detalis.wxml

@@ -0,0 +1,19 @@
+<view class="head">
+    <view style="display: flex;align-items: center;justify-content: space-between;">
+        <view class="user-msg">
+            <van-image custom-class='user-img' round lazy-load width="32rpx" height="32rpx" src="{{detalis.headportraiturl}}" />
+            <text class="name u-line-1">{{detalis.checkby}}</text>
+            <text class="time">{{detalis.checkdate}}</text>
+        </view>
+        <van-button icon='share-o' open-type='share' custom-class='share-but'>分享</van-button>
+    </view>
+    <view class="title">[{{detalis.ftype}}]{{detalis.ftitle}}</view>
+</view>
+<van-tabs active="{{ active }}" color='#00C1D2' title-active-color='#00C1D2' bind:change="tabsOnChange">
+    <van-tab title='分享数{{detalis.fsharetimes}}' />
+    <van-tab title='电话数{{detalis.fphonetimes}}' />
+    <van-tab title='浏览数{{detalis.freadtimes}}' />
+</van-tabs>
+<UserMsg wx:if="{{statisticsData.length}}" list='{{statisticsData}}' />
+<van-empty wx:else description="暂无数据" />
+<My_Canvas></My_Canvas>

+ 5 - 0
pages/tabbar-pages/home/analysis/detalis.wxss

@@ -0,0 +1,5 @@
+@import './index.wxss';
+
+page{
+    background-color: #ffffff !important;
+}

+ 43 - 4
pages/tabbar-pages/home/analysis/index.js

@@ -14,6 +14,7 @@ Page({
         productList: [], //列表
         line: 0, //显示列表下标
         active: 0, //tabs下标
+        statisticsData: {}, //统计数据
     },
 
     /**
@@ -66,13 +67,22 @@ Page({
                 title: res.data,
             })
             const data = handleList.getYTD(res.data);
-
             this.setData({
                 productList: data
             })
+            this.getsupplyanddemandLogTop10(0)
         })
     },
 
+    toDetalis(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: './detalis?item=' + JSON.stringify(item)
+        })
+    },
+    /* 列表下标改变 */
     changeIndex(e) {
         const {
             line
@@ -81,10 +91,39 @@ Page({
         } = e.target.dataset;
         this.setData({
             line,
-            active: index-0
-        })        
+            active: index - 0
+        })
+        this.getsupplyanddemandLogTop10(line)
     },
-
+    /* 获取十条数据 */
+    getsupplyanddemandLogTop10(index) {
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.supplyanddemand.supplyanddemand",
+            "method": "getsupplyanddemandLogTop10",
+            "content": {
+                "tsupplyanddemandid": this.data.productList[index].tsupplyanddemandid
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            for (let i in res.data) {
+                let data = res.data[i];
+                if (data.length > 0) {
+                    for (let index = 0; index < data.length; index++) {
+                        data[index].createdate = data[index].createdate.slice(5, 16)
+                    }
+                    res.data[i] = data
+                };
+            }
+            this.setData({
+                statisticsData: res.data
+            })
+        })
+    },
+    /* tabs改变 */
     tabsOnChange(e) {
         this.setData({
             active: e.detail.index

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

@@ -1,5 +1,6 @@
 {
     "usingComponents": {
-        "My_Search":"/components/My_Search/index"
+        "My_Search": "/components/My_Search/index",
+        "UserMsg": "./UserMsg/index"
     }
 }

+ 13 - 5
pages/tabbar-pages/home/analysis/index.wxml

@@ -7,13 +7,12 @@
         </view>
     </view>
 </view>
-
 <!-- 搜索 -->
 <My_Search></My_Search>
 
 <!-- 列表 -->
 <view class="item-box" wx:for="{{productList}}" wx:key="index">
-    <view class="head">
+    <view class="head" data-item='{{item}}' bindtap="toDetalis">
         <view style="display: flex;align-items: center;justify-content: space-between;">
             <view class="user-msg">
                 <van-image custom-class='user-img' round lazy-load width="32rpx" height="32rpx" src="{{item.headportraiturl}}" />
@@ -31,9 +30,18 @@
             <view data-index="2">浏览数{{item.freadtimes}}</view>
         </view>
         <van-tabs wx:else active="{{ active }}" color='#00C1D2' title-active-color='#00C1D2' bind:change="tabsOnChange">
-            <van-tab title='分享数{{item.fsharetimes}}' />
-            <van-tab title='电话数{{item.fphonetimes}}' />
-            <van-tab title='浏览数{{item.freadtimes}}' />
+            <van-tab title='分享数{{item.fsharetimes}}'>
+                <UserMsg wx:if="{{statisticsData.share.length}}" item='{{item}}' index='0' list='{{statisticsData.share}}' />
+                <van-empty wx:else description="暂无数据" />
+            </van-tab>
+            <van-tab title='电话数{{item.fphonetimes}}'>
+                <UserMsg wx:if="{{statisticsData.phone.length}}" item='{{item}}' index='1' list='{{statisticsData.phone}}' />
+                <van-empty wx:else description="暂无数据" />
+            </van-tab>
+            <van-tab title='浏览数{{item.freadtimes}}'>
+                <UserMsg wx:if="{{statisticsData.read.length}}" item='{{item}}' index='2' list='{{statisticsData.read}}' />
+                <van-empty wx:else description="暂无数据" />
+            </van-tab>
         </van-tabs>
     </view>
 </view>

+ 4 - 3
pages/tabbar-pages/home/analysis/index.wxss

@@ -92,17 +92,18 @@
     white-space: pre-line;
 }
 
-.fake-tabs{
+.fake-tabs {
     display: flex;
     height: 88rpx;
     width: 100vw;
 }
 
-.fake-tabs>view{
+.fake-tabs>view {
     flex: 1;
     display: flex;
     align-items: center;
     justify-content: center;
     color: #646566;
     font-size: 28rpx;
-}
+}
+