Ver Fonte

项目商机

zhaoxiaohai há 2 anos atrás
pai
commit
1ccae9ec90

+ 241 - 53
packageA/project/index.js

@@ -1,66 +1,254 @@
-// packageA/project/index.js
-Page({
+const _Http = getApp().globalData.http,
+    getHeight = require("../../utils/getRheRemainingHeight");
 
-    /**
-     * 页面的初始数据
-     */
+Page({
     data: {
-
+        navList: [{
+            label: "全部",
+            icon: "icon-webxialaxuanxiangjiantou",
+            color: "",
+            width: "",
+            id: "1"
+        }, {
+            label: "创建时间",
+            icon: "icon-quxiao",
+            color: "",
+            width: "",
+            id: "3"
+        }, {
+            label: "筛选",
+            icon: "icon-daoruxialajiantou",
+            color: "",
+            width: "",
+            id: "2"
+        }],
+        classShow: false,
+        classActions: [{
+                name: '全部',
+                index: 0
+            }, {
+                name: '我负责的',
+                index: 1
+            },
+            {
+                name: '我参与的',
+                index: 2
+            },
+            {
+                name: "我下属负责的",
+                index: 3
+            }, {
+                name: "我下属参与的",
+                index: 4
+            }
+        ],
+        content: {
+            "type": 0,
+            "pageNumber": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": "",
+                "status": "",
+                "startdate": "",
+                "enddate": ""
+            },
+            "sort": [{
+                sortname: "默认",
+                sorted: 1,
+                sortid: 68,
+                reversed: 0
+            }]
+        },
+        filter: {
+            show: false,
+            status: ['跟进中', '已成交', '已失败'], //状态项
+            statusActive: "",
+            projectTypeList: [], //项目类型项
+            typeActive: "",
+            stageList: [], //项目阶段项目
+            stageActive: "",
+            startdate: "",
+            enddate: ""
+        }
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
     onLoad(options) {
-
+        this.getList();
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
+    getList(init = false) {
+        if (init.detail != undefined) init = init.detail;
+        if (init) this.setData({
+            ['content.pageNumber']: 1
+        })
+        if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+        _Http.basic({
+            "id": 20221020143502,
+            content: this.data.content
+        }).then(res => {
+            console.log("客户商机列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            // this.getTags(res.data.map(v => v.sys_enterpriseid));
+            this.setData({
+                'content.pageNumber': res.pageNumber + 1,
+                'content.pageTotal': res.pageTotal,
+                'content.total': res.total,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            })
+        })
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
+    /* 处理筛选 */
+    handleFilter({
+        detail
+    }) {
+        const data = this.data.filter;
+        switch (detail) {
+            case 'confirm':
+                this.setData({
+                    'content.where.status': data.statusActive,
+                    "content.where.projecttype": data.typeActive,
+                    "content.where.stagename": data.stageActive,
+                    'content.where.startdate': data.startdate,
+                    'content.where.enddate': data.enddate,
+                    'filter.show': false
+                });
+                this.getList(true);
+                break;
+            case 'reset':
+                this.setData({
+                    'filter.statusActive': "",
+                    'filter.typeActive': "",
+                    'filter.stageActive': "",
+                    'filter.startdate': "",
+                    'filter.enddate': "",
+                });
+                this.getList(true)
+                break;
+            case 'close':
+                this.setData({
+                    'filter.show': false
+                });
+                break;
+        }
     },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
+    /* 筛选状态选择 */
+    selectStatus(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        this.setData({
+            "filter.statusActive": this.data.filter.statusActive == item ? "" : item
+        })
     },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
+    /* 筛选项目类 */
+    selectTypeName(e) {
+        const {
+            value
+        } = e.currentTarget.dataset.item;
+        if (this.data.filter.typeActive == value) return;
+        this.setData({
+            "filter.typeActive": value
+        });
+        _Http.basic({
+            "id": 20221107150004,
+            "content": {
+                "projecttype": value
+            }
+        }).then(res => {
+            console.log("模板阶段", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                "filter.stageList": res.data,
+                "filter.stageActive": ""
+            })
+        })
 
     },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
+    /* 筛选阶段 */
+    stageStatus(e) {
+        const {
+            stagename
+        } = e.currentTarget.dataset.item;
+        this.setData({
+            "filter.stageActive": stagename
+        })
     },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
+    /* 筛选日期范围 */
+    changeDate(e) {
+        const name = e.currentTarget.dataset.name,
+            value = e.detail.value;
+        this.setData({
+            [`filter.${name}`]: value
+        })
     },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
+    /* 顶部条件导航回调 */
+    navClick({
+        detail
+    }) {
+        switch (detail.id) {
+            case '1':
+                this.setData({
+                    classShow: true
+                })
+                break;
+            case '2':
+                _Http.basic({
+                    "classname": "sysmanage.develop.optiontype.optiontype",
+                    "method": "optiontypeselect",
+                    "content": {
+                        nocache: true,
+                        "pageNumber": 1,
+                        "pageSize": 999,
+                        "typename": "projecttype",
+                        "parameter": {
+                            "siteid": wx.getStorageSync('siteP').siteid
+                        }
+                    }
+                }).then(res => {
+                    console.log("项目类型", res)
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.data,
+                        icon: "none"
+                    })
+                    this.setData({
+                        'filter.show': true,
+                        'filter.projectTypeList': res.data,
+                    })
+                })
+                break;
+            case '3':
+                this.setData({
+                    'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
+                });
+                this.getList(true)
+                break;
+        }
+    },
+    classClose() {
+        this.setData({
+            classShow: false
+        })
+    },
+    classSelect({
+        detail
+    }) {
+        if (this.data.content.type == detail.index) return this.classClose();
+        this.setData({
+            "content.type": detail.index,
+            'navList[0].label': detail.name
+        })
+        this.classClose();
+        this.getList(true)
+    },
+    onReady() {
+        getHeight.getHeight('.total', this).then(res => this.setData({
+            listHeight: res
+        }));
+    },
+    onShareAppMessage() {}
 })

+ 2 - 1
packageA/project/index.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+    "usingComponents": {},
+    "navigationBarTitleText": "项目商机"
 }

+ 16 - 1
packageA/project/index.scss

@@ -1 +1,16 @@
-/* packageA/project/index.wxss */
+@import "../../components/Yl_filtrate/groud.scss";
+
+page {
+    height: 100vh;
+    overflow: hidden;
+}
+
+.total {
+    height: 64rpx;
+    line-height: 64rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #666666;
+    background: #F4F5F7;
+    padding-left: 30rpx;
+}

+ 54 - 2
packageA/project/index.wxml

@@ -1,2 +1,54 @@
-<!--packageA/project/index.wxml-->
-<text>packageA/project/index.wxml</text>
+<Yl_nav search list='{{navList}}' bind:onClick='navClick' bind:onSearch='navSearch' />
+<!-- 显示类型 -->
+<van-action-sheet show="{{ classShow }}" actions="{{ classActions }}" cancel-text="取消" bind:cancel="classClose" bind:select="classSelect" />
+<view class="total">共{{content.total}}个</view>
+
+<My_listBox id='ListBox' height="{{listHeight}}" bind:getlist='getList'>
+    <!-- <list list='{{list}}' /> -->
+</My_listBox>
+
+
+<!-- 筛选条件 -->
+<Yl_filtrate show="{{filter.show}}" bind:handle="handleFilter">
+    <view class="groud" wx:if="{{filter.projectTypeList.length!=0}}">
+        <view class="label">
+            项目类型
+        </view>
+        <view class="content">
+            <van-button custom-class='but {{filter.typeActive==item.value?"active":""}}' wx:for="{{filter.projectTypeList}}" wx:key="item.rowindex" bindtap="selectTypeName" data-item="{{item}}">{{item.value}}</van-button>
+        </view>
+    </view>
+    <view class="groud" wx:if="{{filter.stageList.length!=0}}">
+        <view class="label">
+            项目阶段
+        </view>
+        <view class="content">
+            <van-button custom-class='but {{filter.stageActive==item.stagename?"active":""}}' wx:for="{{filter.stageList}}" wx:key="item.stagename" bindtap="stageStatus" data-item="{{item}}">{{item.stagename}}</van-button>
+        </view>
+    </view>
+    <view class="groud">
+        <view class="label">
+            项目状态
+        </view>
+        <view class="content">
+            <van-button custom-class='but {{filter.statusActive==item?"active":""}}' wx:for="{{filter.status}}" wx:key="item" bindtap="selectStatus" data-item="{{item}}">{{item}}</van-button>
+        </view>
+    </view>
+    <view class="groud">
+        <view class="label">
+            时间范围
+        </view>
+        <view class="content time">
+            <picker mode="date" bindchange='changeDate' data-name="startdate">
+                <view class="tbox">{{filter.startdate||'开始时间'}}</view>
+            </picker>
+            <view class="partition">-</view>
+            <picker mode="date" bindchange='changeDate' data-name="enddate">
+                <view class="tbox">{{filter.enddate||"结束时间"}}</view>
+            </picker>
+        </view>
+    </view>
+</Yl_filtrate>
+
+<!-- 浮动按钮 -->
+<Yl_FloatingButton bindtap="toAdd" />