zhaoxiaohai 3 years ago
parent
commit
65f578aae6

+ 65 - 0
packageA/group/index.js

@@ -0,0 +1,65 @@
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+        content: {
+            "ownertable": "sa_itemgroup",
+            "ownerid": 11,
+            pageSize: 20,
+            pageNumber: 1,
+            pageTotal: 1,
+            "where": {
+                "condition": ""
+            }
+        },
+        list: [],
+        result: [],
+    },
+    onLoad(options) {
+        console.log(options)
+        if (options.ownertable) {
+            this.setData({
+                content: {
+                    ...options
+                }
+            });
+            this.getList();
+            console.log(this.data.content)
+        }
+    },
+    onChange(e) {
+        const userid = e.currentTarget.dataset.item.userid + "";
+        if (!userid) return;
+        let result = this.data.result;
+        if (result.some(v => v == userid)) {
+            result = result.filter(v => v != userid)
+        } else {
+            result.push(userid)
+        }
+        this.setData({
+            result
+        })
+    },
+    getList(init = false) {
+        let content = this.data.content;
+        if (init) {
+            content.pageTotal = 1
+            content.pageNumber = 1
+        }
+        if (content.pageNumber > content.pageTotal) return;
+        _Http.basic({
+            "id": 20221018122201,
+            content
+        }).then(res => {
+            console.log("数据团队列表", res)
+            this.setData({
+                list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                "content.pageTotal": res.pageTotal,
+                "content.pageNumber": res.pageNumber + 1,
+            })
+        })
+    },
+    onReachBottom() {
+        this.getList();
+    }
+})

+ 4 - 0
packageA/group/index.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "团队"
+}

+ 92 - 0
packageA/group/index.scss

@@ -0,0 +1,92 @@
+.box {
+    width: 100vw;
+    background-color: #fff;
+    box-sizing: border-box;
+
+    .item {
+        display: flex;
+        width: 100%;
+        padding-left: 30rpx;
+        box-sizing: border-box;
+
+        .checkbox {
+            display: flex;
+            align-items: center;
+            width: 58rpx;
+            height: 120rpx;
+        }
+
+        .user {
+            display: flex;
+            align-items: center;
+            width: 100%;
+            height: 120rpx;
+            border-bottom: 1px solid #ddd;
+            box-sizing: border-box;
+
+            .portrait {
+                width: 80rpx;
+                height: 80rpx;
+                background: #3874F6;
+                border-radius: 50%;
+                text-align: center;
+                line-height: 80rpx;
+                font-size: 28rpx;
+                font-family: PingFang SC-Regular, PingFang SC;
+                color: #FFFFFF;
+                flex-shrink: 0;
+            }
+
+            .exp {
+                width: 100%;
+                margin-left: 20rpx;
+
+                .line-1 {
+                    height: 42rpx;
+                    font-size: 30rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                    color: #333333;
+                }
+
+                .phone {
+                    font-size: 24rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                    color: #999999;
+                    margin-top: 4rpx;
+                }
+            }
+        }
+
+    }
+}
+
+.footer {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 30rpx;
+    position: fixed;
+    width: 100vw;
+    height: 130rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+    box-sizing: border-box;
+
+    .count {
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+    }
+
+    .but {
+        width: 156rpx;
+        height: 90rpx;
+        background: #3874F6;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+    }
+}

+ 39 - 0
packageA/group/index.wxml

@@ -0,0 +1,39 @@
+<van-search value="{{ value }}" shape="round" background="#fff" placeholder="搜索姓名、手机号" bind:change='onInput' />
+<view style="height: 20rpx;" />
+<van-checkbox-group value="{{ result }}">
+    <view class="box">
+        <navigator url="#" class="item" wx:for="{{list}}" wx:key="item.userid" data-item="{{item}}" bindtap="onChange">
+            <view class="checkbox">
+                <van-checkbox shape='square' icon-size='14' name="{{item.userid}}" />
+            </view>
+            <view class="user">
+                <view class="portrait">
+                    {{item.name[0]}}
+                </view>
+                <view class="exp">
+                    <view class="line-1">
+                        {{item.name}}
+                    </view>
+                    <view class="phone">
+                        {{item.phonenumber}}
+                    </view>
+                </view>
+            </view>
+        </navigator>
+    </view>
+</van-checkbox-group>
+<view style="height: 130rpx;" />
+<view class="footer">
+    <view class="count">
+        已选:{{result.length}}
+    </view>
+    <van-button custom-class='but'>确定</van-button>
+</view>
+
+<wxs module="active">
+    module.exports.que = function (name, list) {
+        return list.some(function (v) {
+            return v === name
+        })
+    }
+</wxs>

+ 43 - 0
packageA/group/modules/Yl-group/index.js

@@ -0,0 +1,43 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+        add: Boolean, //是否允许新增
+        ownertable: {
+            type: String,
+            value: "sa_itemgroup"
+        },
+        ownerid: {
+            type: String,
+            value: 11
+        }
+    },
+    data: {
+        list: [],
+    },
+    methods: {
+        getList() {
+            _Http.basic({
+                "id": 20220930103501,
+                "content": {
+                    ownertable: this.data.ownertable,
+                    ownerid: this.data.ownerid,
+                    pageSize: this.data.add ? 8 : 9
+                }
+            }).then(res => {
+                console.log("团队", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                });
+                this.setData({
+                    list: res.data
+                })
+            })
+        },
+        addUser() {
+            wx.navigateTo({
+                url: '/packageA/group/index?ownertable=' + this.data.ownertable + '&ownerid=' + this.data.ownerid,
+            })
+        },
+    }
+})

+ 4 - 0
packageA/group/modules/Yl-group/index.json

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

+ 55 - 0
packageA/group/modules/Yl-group/index.scss

@@ -0,0 +1,55 @@
+.group-box {
+    display: flex;
+    align-items: center;
+    width: 100%;
+    height: 60rpx;
+
+    .label {
+        height: 34rpx;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #666666;
+        flex-shrink: 0;
+    }
+
+    .list {
+        display: flex;
+        overflow: hidden;
+        max-width: 100%;
+
+        .item {
+            width: 64rpx;
+            height: 64rpx;
+            text-align: center;
+            line-height: 64rpx;
+            flex-shrink: 0;
+            border-radius: 50%;
+            background-color: #3874F6;
+            margin-right: 8rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #FFFFFF;
+        }
+    }
+
+    .right {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        flex-shrink: 0;
+        width: 64rpx;
+        height: 64rpx;
+        border-radius: 50%;
+
+        >view {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            width: 32rpx;
+            height: 32rpx;
+            border-radius: 50%;
+            background: #E7EEFF;
+            color: #3874F6;
+        }
+    }
+}

+ 18 - 0
packageA/group/modules/Yl-group/index.wxml

@@ -0,0 +1,18 @@
+<view class="group-box">
+    <view class="label">
+        团队:
+    </view>
+    <view class="list">
+        <!-- 最多八个 -->
+        <block wx:for="{{8}}">
+            <navigator url="#" class="item">
+                z
+            </navigator>
+        </block>
+    </view>
+    <navigator url="#" class="right" wx:if="{{add}}" bindtap="addUser">
+        <view>
+            <van-icon name="arrow" size='10' />
+        </view>
+    </navigator>
+</view>