| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view class="container">
- <!-- 搜索框区域 -->
- <view class="search">
- <img src="../../static/images/repairsImg/search.png" @click="getData" />
- <input type="text" v-model="keyWord" placeholder="请输入搜索内容" />
- </view>
- <view class="title" v-if="list2.length">外部维修成员({{ list2.length }})</view>
- <!-- 每一个外部维修成员区域 -->
- <view class="box" v-for="item in list2" :key="item.id" @click="handleEdit(item)">
- <img src="../../static/images/repairsImg/photo.png" />
- <view class="item_info">
- <view class="info_msg">
- {{ item.userName }}
- <view class="msg_work">{{ item.workTypeName }}</view>
- </view>
- <view class="info_phone">{{ item.userPhone }}</view>
- </view>
- <view class="item_type color_type2" v-if="item.state === 1">正常接单</view>
- <view class="item_type color_type3" v-if="item.state === 2">停止接单</view>
- </view>
- <view class="title" v-if="list.length">内部维修成员({{ list.length }})</view>
- <!-- 每一个内部维修成员区域 -->
- <view class="box" v-for="item in list" :key="item.id" @click="handleEdit(item)">
- <img src="../../static/images/repairsImg/photo.png" />
- <view class="item_info">
- <view class="info_msg">
- {{ item.userName }}
- <view class="msg_work">{{ item.workTypeName }}</view>
- </view>
- <view class="info_phone">{{ item.userPhone }}</view>
- </view>
- <view class="item_type color_type2" v-if="item.state === 1">正常接单</view>
- <view class="item_type color_type3" v-if="item.state === 2">停止接单</view>
- </view>
- <!-- 没有数据时展示的图片 -->
- <view class="no_data" v-if="list.length === 0 && list2.length === 0">
- <img src="../../pagesClockIn/static/imgs/nodata.png" />
- <view>暂无数据</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 搜索框绑定数据
- keyWord: '',
- // 校区id
- schoolId: '',
- // 用户id
- userId: '',
- // 内部维修成员数组
- list: [],
- // 外部维修成员数组
- list2: []
- }
- },
- mounted() {
- const userInfo = uni.getStorageSync('repairsUserInfo')
- this.userId = userInfo.userId
- this.schoolId = userInfo.schoolId
- this.getData()
- },
- methods: {
- async getData() {
- const res = await this.$myRequest_repairs({
- url: '/repairUser/getAddressBook',
- data: {
- schoolId: this.schoolId,
- userId: this.userId,
- keyWord: this.keyWord
- }
- })
- // console.log(res)
- if (res.code === '200') {
- this.list = res.data[0].list
- this.list2 = res.data[1].list
- }
- },
- handleEdit(item) {
- // console.log(item.id)
- uni.showActionSheet({
- itemList: ['编辑', '删除'],
- success: (res) => {
- if (res.tapIndex === 0) {
- let info = JSON.stringify(item)
- uni.navigateTo({
- url: `/pagesRepairs/edit/edit?info=${info}`
- })
- } else if (res.tapIndex === 1) {
- uni.showModal({
- title: '提示',
- content: `确定删除${item.userName}吗?`,
- success: async (res) => {
- if (res.confirm) {
- const res = await this.$myRequest_repairs({
- url: '/repairUser/deleteRepairUserSettingById',
- data: {
- id: item.id
- }
- })
- // console.log(res)
- if (res.code === '200') {
- uni.showToast({
- title: '删除成功',
- icon: 'success'
- })
- setTimeout(() => {
- this.getData()
- }, 1500)
- }
- }
- }
- })
- }
- },
- fail: (res) => {}
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- width: 100vw;
- height: calc(100vh - 152rpx);
- font-size: 32rpx;
- overflow-y: auto;
- .search {
- display: flex;
- align-items: center;
- margin: 30rpx auto 30rpx;
- width: 690rpx;
- height: 80rpx;
- border-radius: 4rpx;
- background-color: #f2f2f2;
- img {
- margin: 0 20rpx;
- width: 40rpx;
- height: 40rpx;
- }
- input {
- flex: 1;
- padding: 10rpx;
- }
- }
- .title {
- display: flex;
- align-items: flex-end;
- box-sizing: border-box;
- padding: 0 30rpx;
- height: 80rpx;
- font-size: 36rpx;
- font-weight: bold;
- border-top: 1rpx solid #e5e5e5;
- }
- .box {
- display: flex;
- align-items: center;
- padding-right: 30rpx;
- height: 160rpx;
- border-bottom: 1rpx solid #e5e5e5;
- img {
- margin: 0 24rpx 0 27rpx;
- width: 82rpx;
- height: 82rpx;
- border-radius: 50%;
- }
- .item_info {
- display: flex;
- flex-direction: column;
- .info_msg {
- display: flex;
- align-items: center;
- font-size: 32rpx;
- font-weight: bold;
- .msg_work {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 13rpx;
- padding: 0 10rpx;
- height: 32rpx;
- color: #6fb6b8;
- font-size: 24rpx;
- font-weight: 400;
- border-radius: 7rpx;
- border: 1rpx solid #6fb6b8;
- }
- }
- .info_phone {
- margin-top: 10rpx;
- color: #808080;
- // font-size: 28rpx;
- }
- }
- .item_type {
- margin-left: auto;
- // font-size: 24rpx;
- }
- .color_type2 {
- color: #1e7dfb;
- }
- .color_type3 {
- color: #ff5733;
- }
- }
- .no_data {
- text-align: center;
- color: #b3b3b3;
- font-size: 24rpx;
- img {
- margin: 215rpx auto 0;
- width: 480rpx;
- height: 508rpx;
- }
- }
- }
- </style>
|