zhaoxiaohai 3 лет назад
Родитель
Сommit
c1a4e01158

+ 251 - 0
packageA/offers/index.js

@@ -0,0 +1,251 @@
+const _Http = getApp().globalData.http,
+    getHeight = require("../../utils/getRheRemainingHeight");
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        typeList: [{
+            name: '普通报价',
+            index: 0
+        }, {
+            name: '项目报价',
+            index: 1
+        }],
+        typeShow: false,
+        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,
+            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.startdate = data.startdate;
+            content.where.enddate = data.enddate;
+        }
+        _Http.basic({
+            "id": 20221020165103,
+            content
+        }).then(res => {
+            console.log("报价单列表", res)
+            this.selectComponent('#ListBox').RefreshToComplete();
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            res.data = res.data.map(v => {
+                v.progress = v.stage / v.totalstage * 100;
+                return v
+            })
+            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_quotedpriceid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_quotedprice",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_quotedpriceid == key);
+                list[index].tags = res.data[key]
+            };
+            this.setData({
+                list
+            })
+        })
+    },
+    /* 去添加 */
+    openType() {
+        this.setData({
+            typeShow: true
+        })
+    },
+    typeCancel() {
+        this.setData({
+            typeShow: false
+        })
+    },
+    /* 选择添加报价形式 */
+    typeSelect({
+        detail
+    }) {
+        wx.navigateTo({
+            url: detail.name == '项目报价' ? '/packageA/offers/addProjectOffer' : '/packageA/offers/addSetclientOffer',
+        });
+        this.typeCancel();
+    },
+    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
+        })
+    },
+    /* 处理筛选 */
+    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/offers/index.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "List": "./modules/list/index"
+    },
+    "navigationBarTitleText": "报价单"
+}

+ 16 - 0
packageA/offers/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;
+}

+ 38 - 0
packageA/offers/index.wxml

@@ -0,0 +1,38 @@
+<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.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" />
+
+<van-action-sheet show="{{ typeShow }}" actions="{{ typeList }}" cancel-text="取消" bind:cancel='typeCancel' bind:select='typeSelect' />

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

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

+ 4 - 0
packageA/offers/modules/list/index.json

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

+ 33 - 0
packageA/offers/modules/list/index.scss

@@ -0,0 +1,33 @@
+.offer-list {
+    width: 100%;
+    padding: 20rpx 30rpx;
+    box-sizing: border-box;
+    overflow: hidden;
+    background-color: #fff;
+
+    .title {
+        height: 42rpx;
+        line-height: 42rpx;
+        font-size: 30rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
+    .exp {
+        height: 34rpx;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #666;
+        margin-top: 8rpx;
+
+        text {
+            color: #333333;
+        }
+    }
+}
+
+.line-1 {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+}

+ 9 - 0
packageA/offers/modules/list/index.wxml

@@ -0,0 +1,9 @@
+<My_empty wx:if="{{list.length==0}}" />
+<navigator class="offer-list" url="#">
+    <view class="title line-1">
+        萨达佛撒谎地富哦俺是丢发还到付号东方红撒IU电饭锅数一顿饭萨达阿斯蒂芬
+    </view>
+    <view class="exp line-1">项目名称:<text>阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三</text></view>
+    <view class="exp line-1">报价日期:<text>阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三</text></view>
+    <view class="exp line-1">项目名称:<text>阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三阿斯顿发送到阿萨德阿萨德阿萨德阿萨德阿三</text></view>
+</navigator>