zhaoxiaohai 3 年之前
父節點
當前提交
be2247d4a9

+ 230 - 0
packageA/contract/index.js

@@ -0,0 +1,230 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../utils/getRheRemainingHeight");
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        navList: [{
+            label: "全部",
+            icon: "icon-webxialaxuanxiangjiantou",
+            color: "",
+            width: "",
+            id: "1"
+        }, {
+            label: "排序",
+            icon: "icon-shengxu",
+            color: "",
+            width: "",
+            id: "sort"
+        }, {
+            label: "筛选",
+            icon: "icon-shaixuan",
+            color: "",
+            width: "",
+            id: "2"
+        }],
+        classShow: false,
+        classActions: [{
+                name: '全部',
+                index: 0
+            }, {
+                name: '我负责的',
+                index: 1
+            },
+            {
+                name: '我参与的',
+                index: 2
+            },
+            {
+                name: "我下属负责的",
+                index: 3
+            }, {
+                name: "我下属参与的",
+                index: 4
+            }
+        ],
+        content: {
+            "nocache": true,
+            "type": 0,
+            "version": 1,
+            "pageNumber": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": "",
+                "startdate": "",
+                "enddate": "",
+                "status": "",
+            },
+            "sort": []
+        },
+        filter: {
+            show: false,
+            type: ['普通报价', '项目报价'], //状态项
+            typeActive: "",
+            status: ['新建', '提交', '审核'], //状态项
+            statusActive: "",
+            startdate: "",
+            enddate: ""
+        }
+    },
+    onLoad(options) {
+        this.getList();
+    },
+    /* 获取列表 */
+    getList(init = false, data) {
+        if (init.detail != undefined) init = init.detail;
+        let content = this.data.content;
+        if (init) content.pageNumber = 1;
+        if (content.pageNumber > content.pageTotal) return;
+        if (data) {
+            content.where.status = data.statusActive;
+            content.where.begindate = data.startdate;
+            content.where.enddate = data.enddate;
+        }
+        _Http.basic({
+            "id": 20221121201502,
+            content
+        }).then(res => {
+            console.log("合同列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                'content.pageNumber': res.pageNumber + 1,
+                'content.pageTotal': res.pageTotal,
+                'content.total': res.total,
+                'content.sort': res.sort,
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+            });
+            this.setListHeight();
+            this.getTags();
+        })
+    },
+    /* 处理搜索 */
+    onSearch({
+        detail
+    }) {
+        this.setData({
+            "content.where.condition": detail
+        });
+        this.getList(true);
+    },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_contractid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_contract",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_contractid == key);
+                list[index].tags = res.data[key]
+            };
+            this.setData({
+                list
+            })
+        })
+    },
+    onReady() {
+        this.setListHeight();
+    },
+    setListHeight() {
+        getHeight.getHeight('.total', this).then(res => {
+            if (this.data.listHeight != res)
+                this.setData({
+                    listHeight: res
+                })
+        });
+    },
+    /* 顶部条件导航回调 */
+    navClick({
+        detail
+    }) {
+        switch (detail.id) {
+            case '1':
+                this.setData({
+                    classShow: true
+                })
+                break;
+            case '2':
+                this.setData({
+                    'filter.show': 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)
+    },
+    /* 筛选状态选择 */
+    selectStatus(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        this.setData({
+            "filter.statusActive": this.data.filter.statusActive == item ? "" : item
+        })
+    },
+    /* 筛选状态选择 */
+    typeStatus(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        this.setData({
+            "filter.typeActive": this.data.filter.typeActive == item ? "" : item
+        })
+    },
+    /* 处理筛选 */
+    handleFilter({
+        detail
+    }) {
+        const data = this.data.filter;
+        switch (detail) {
+            case 'confirm':
+                this.setData({
+                    'filter.show': false
+                });
+                this.getList(true, data);
+                break;
+            case 'reset':
+                this.setData({
+                    'filter.statusActive': "",
+                    'filter.startdate': "",
+                    'filter.enddate': "",
+                });
+                this.getList(true, this.data.filter)
+                break;
+            case 'close':
+                this.setData({
+                    'filter.show': false
+                });
+                break;
+        }
+    },
+    onShareAppMessage() {
+
+    }
+})

+ 6 - 0
packageA/contract/index.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "List": "./modules/list/index"
+    },
+    "navigationBarTitleText": "合同"
+}

+ 16 - 0
packageA/contract/index.scss

@@ -0,0 +1,16 @@
+@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;
+}

+ 45 - 0
packageA/contract/index.wxml

@@ -0,0 +1,45 @@
+<Yl_nav search list='{{navList}}' sort='{{content.sort}}' bind:onClick='navClick' bindonSearch="onSearch" />
+<!-- 显示类型 -->
+<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}}' />
+    <view style="height: 80rpx;" />
+</My_listBox>
+
+<!-- 筛选条件 -->
+<Yl_filtrate show="{{filter.show}}" bind:handle="handleFilter">
+    <view class="groud">
+        <view class="label">
+            合同类型
+        </view>
+        <view class="content">
+            <van-button custom-class='but {{filter.typeActive==item?"active":""}}' wx:for="{{filter.type}}" wx:key="item" bindtap="typeStatus" data-item="{{item}}">{{item}}</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="openType" /> -->

+ 11 - 0
packageA/contract/modules/list/index.js

@@ -0,0 +1,11 @@
+Component({
+    properties: {
+        list: Array
+    },
+    data: {
+
+    },
+    methods: {
+
+    }
+})

+ 79 - 0
packageA/contract/modules/list/index.scss

@@ -0,0 +1,79 @@
+.offer-list {
+    width: 100%;
+    padding: 20rpx 30rpx;
+    box-sizing: border-box;
+    background-color: #fff;
+    border-bottom: 1rpx solid #ddd;
+    font-family: PingFang SC-Regular, PingFang SC;
+
+    .title {
+        position: relative;
+        display: flex;
+        height: 42rpx;
+        align-items: center;
+
+        >text {
+            display: inline-block;
+            width: 80%;
+            font-size: 30rpx;
+            color: #333333;
+        }
+
+        .status {
+            position: absolute;
+            right: -30rpx;
+            width: 132rpx;
+            height: 40rpx;
+            border-radius: 20rpx 0px 0px 20rpx;
+            box-sizing: border-box;
+            padding-left: 30rpx;
+            line-height: 40rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #FFFFFF;
+        }
+    }
+
+    .tag-box {
+        display: flex;
+        align-items: center;
+        width: 100%;
+
+        .datatag,
+        .systemtag {
+            flex-shrink: 0;
+            margin-top: 6rpx;
+            background: #FAAB16;
+            color: #ffffff;
+            margin-right: 10rpx;
+            display: flex;
+            align-items: center;
+            height: 40rpx;
+            font-size: 20rpx;
+            padding: 0 10rpx;
+            border-radius: 20rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+        }
+
+        .systemtag {
+            background: #FA8C16;
+        }
+    }
+
+    .exp {
+        height: 34rpx;
+        font-size: 24rpx;
+        color: #666;
+        margin-top: 8rpx;
+
+        text {
+            color: #333333;
+        }
+    }
+}
+
+.line-1 {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}

+ 54 - 0
packageA/contract/modules/list/index.wxml

@@ -0,0 +1,54 @@
+<My_empty wx:if="{{list.length==0}}" />
+<navigator class="offer-list" url="/packageA/offers/detail?sa_quotedpriceid={{item.sa_quotedpriceid}}" wx:for="{{list}}" wx:key="item.billno">
+    <view class="title">
+        <text class="line-1">{{item.salername}}</text>
+        <view class="status" style="background-color: {{handle.getColor(item.status)}};">{{item.status}}</view>
+    </view>
+    <view class="tag-box">
+        <view class="systemtag" wx:for="{{item.tags.systemtag}}" wx:key="item">{{item}}</view>
+        <view class="datatag" wx:for="{{item.tags.datatag}}" wx:key="item">{{item}}</view>
+    </view>
+    <view class="exp line-1">编号:<text>{{item.billno}}</text></view>
+    <view class="exp line-1">合同类型:<text>{{handle.getType(item.type)}}</text></view>
+    <view class="exp line-1">有效期:<text>{{item.begdate}} 至 {{item.enddate}}</text></view>
+</navigator>
+
+<wxs module="handle">
+    module.exports = {
+        getColor: function (status) {
+            var color = null;
+            if (status == '新建') {
+                color = '#3874F6';
+            } else if (status == '提交') {
+                color = '#52C41A';
+            } else {
+                color = '#FA8C16';
+            };
+            return color
+        },
+        getType: function (type) {
+            var result = "";
+            switch (type) {
+                case "框架":
+                    result = '经销商合作协议'
+                    break;
+                case "经销项目":
+                    result = '经销项目协议'
+                    break;
+                case "直销项目":
+                    result = '直销项目协议'
+                    break;
+                case "工具借用":
+                    result = '工具使用协议'
+                    break;
+                case "居间":
+                    result = '居间协议'
+                    break;
+                default:
+                    result = '--'
+                    break;
+            };
+            return result;
+        }
+    }
+</wxs>