qingyiay
2023-05-10 29658de29b2eb5292bf0c2fad7427b374b769ebc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<template>
    <view>
        <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="userList.length == 0"></u-empty>
        <u-list @scrolltolower="scrolltolower">
            <u-list-item v-for="(item, index) in userList" :key="index">
                <u-cell size="large" center :label="item.deptNames">
                    <view slot="title" class="u-slot-title">
                        <text class="u-cell-text">{{ item.name }}</text>
                    </view>
                    <view slot="value" class="u-slot-value">
                        <u-tag text="查看" type="primary" plain size="mini" icon="eye" @click="viewInfo(item)"></u-tag>
                        <u-tag text="编辑" type="primary" plain size="mini" icon="edit-pen" @click="editInfo(item)"></u-tag>
                        <u-tag text="删除" type="warning" plain size="mini" icon="trash" @click="deleteInfo(item)"></u-tag>
                    </view>
                </u-cell>
            </u-list-item>
        </u-list>
        <u-popup :show="infoShow" mode="center" :round="10" :closeable="true" @close="close">
            <view class="info-main">
                <view class="info-block">
                    <view class="info-block_label">服务矿场</view>
                    <view class="info-block_value">{{ userInfo.deptNames }}</view>
                </view>
                <view class="info-block">
                    <view class="info-block_label">身份证</view>
                    <view class="info-block_value">{{ userInfo.idCard }}</view>
                </view>
                <view class="info-block">
                    <view class="info-block_label">真实姓名</view>
                    <view class="info-block_value">{{ userInfo.name }}</view>
                </view>
                <view class="info-block">
                    <view class="info-block_label">手机号</view>
                    <view class="info-block_value">{{ userInfo.phone }}</view>
                </view>
            </view>
        </u-popup>
        <view class="add-icon" @click.stop="addUser"><u-icon name="plus" color="#fff" size="40"></u-icon></view>
        <u-modal :show="deleteShow" title="删除" content="确认删除?" @confirm="deleteConfirm" @cancel="deleteCancel" :showCancelButton="true"></u-modal>
    </view>
</template>
 
<script>
export default {
    data() {
        return {
            userList: [],
            infoShow: false,
            userInfo: {},
            deleteShow: false,
            userId: ''
        };
    },
    onShow() {
        this.getappUserPage();
    },
    methods: {
        close() {
            this.infoShow = false;
        },
        getappUserPage() {
            uni.showLoading({
                title: '加载中'
            });
            this.$reqGet('appUserPage').then(res => {
                this.userList = res.data.records;
                uni.hideLoading();
            });
        },
        scrolltolower() {},
        // 查看信息
        viewInfo(v) {
            uni.showLoading({
                title: '加载中'
            });
            this.$reqGet('getAppById', { userId: v.userId.toString() }).then(res => {
                if (res.code == 0) {
                    uni.hideLoading();
                    this.userInfo = res.data;
                    this.infoShow = true;
                } else {
                    this.$u.toast('加载失败');
                }
            });
        },
        // 编辑信息
        editInfo(v) {
            uni.navigateTo({
                url: `/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit?userId=${v.userId}`
            });
        },
        // 删除信息
        deleteInfo(v) {
            this.userId = v.userId.toString();
            this.deleteShow = true;
        },
        deleteConfirm() {
            uni.showLoading({
                title: '加载中'
            });
            this.$reqPost('appRemoveById', { userId: this.userId }, 'params')
                .then(res => {
                    if (res.code === 0) {
                        uni.hideLoading();
                        this.$u.toast('删除成功');
                        this.deleteShow = false;
                    } else {
                        uni.hideLoading();
                        this.$u.toast('删除失败');
                        this.deleteShow = false;
                    }
                })
                .then(() => {
                    this.getappUserPage();
                });
        },
        deleteCancel() {
            this.deleteShow = false;
        },
        // 点击添加按钮
        addUser() {
            uni.navigateTo({
                url: '/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit'
            });
        }
    }
};
</script>
 
<style lang="scss" scoped>
@mixin flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/deep/ .u-slot-value {
    width: 150px;
    height: 60px;
    @include flex;
}
.info-main {
    width: 690rpx;
    height: 600rpx;
    @include flex;
    flex-direction: column;
    padding: vww(10);
    box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
    .info-block {
        width: 94%;
        height: 120rpx;
        @include flex;
        border-bottom: 1px solid #d6d6d6;
        &_label {
            line-height: 28rpx;
            font-size: 28rpx;
            font-weight: 300;
            color: #303030;
        }
        &_value {
            line-height: 28rpx;
            font-size: 28rpx;
            font-weight: 300;
            color: #303030;
        }
    }
}
.add-icon {
    position: fixed;
    bottom: vww(60);
    right: vww(20);
    width: 89rpx;
    height: 89rpx;
    border-radius: 50%;
    background: #035cfb;
    @include flex;
    justify-content: center;
}
</style>