addressBook.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="container">
  3. <!-- 搜索框区域 -->
  4. <view class="search">
  5. <img src="../../static/images/repairsImg/search.png" @click="getData" />
  6. <input type="text" v-model="keyWord" placeholder="请输入搜索内容" />
  7. </view>
  8. <view class="title" v-if="list.length">外部维修成员({{ list.length }})</view>
  9. <!-- 每一个外部维修成员区域 -->
  10. <view class="box" v-for="item in list" :key="item.id" @click="handleEdit(item)">
  11. <img src="../../static/images/repairsImg/photo.png" />
  12. <view class="item_info">
  13. <view class="info_msg">
  14. {{ item.userName }}
  15. <view class="msg_work">{{ item.workTypeName }}</view>
  16. </view>
  17. <view class="info_phone">{{ item.userPhone }}</view>
  18. </view>
  19. <view class="item_type color_type2" v-if="item.state === 1">大量接单</view>
  20. <view class="item_type color_type3" v-if="item.state === 2">停止接单</view>
  21. </view>
  22. <view class="title" v-if="list2.length">内部维修成员({{ list2.length }})</view>
  23. <!-- 每一个内部维修成员区域 -->
  24. <view class="box" v-for="item in list2" :key="item.id" @click="handleEdit(item)">
  25. <img src="../../static/images/repairsImg/photo.png" />
  26. <view class="item_info">
  27. <view class="info_msg">
  28. {{ item.userName }}
  29. <view class="msg_work">{{ item.workTypeName }}</view>
  30. </view>
  31. <view class="info_phone">{{ item.userPhone }}</view>
  32. </view>
  33. <view class="item_type color_type2" v-if="item.state === 1">大量接单</view>
  34. <view class="item_type color_type3" v-if="item.state === 2">停止接单</view>
  35. </view>
  36. <!-- 没有数据时展示的图片 -->
  37. <view class="no_data" v-if="list.length === 0 && list2.length === 0">
  38. <img src="../../pagesClockIn/static/imgs/nodata.png" />
  39. <view>暂无数据</view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. // 搜索框绑定数据
  48. keyWord: '',
  49. // 校区id
  50. schoolId: '',
  51. // 用户id
  52. userId: '',
  53. // 外部维修成员数组
  54. list: [],
  55. // 内部维修成员数组
  56. list2: []
  57. }
  58. },
  59. mounted() {
  60. console.log('通讯录页面加载')
  61. const userInfo = uni.getStorageSync('repairsUserInfo')
  62. this.userId = userInfo.userId
  63. this.schoolId = userInfo.schoolId
  64. this.getData()
  65. },
  66. methods: {
  67. async getData() {
  68. const res = await this.$myRequest_repairs({
  69. url: '/repairUser/getAddressBook',
  70. data: {
  71. schoolId: this.schoolId,
  72. userId: this.userId,
  73. keyWord: this.keyWord
  74. }
  75. })
  76. // console.log(res)
  77. if (res.code === '200') {
  78. this.list = res.data[0].list
  79. this.list2 = res.data[1].list
  80. }
  81. },
  82. handleEdit(item) {
  83. // console.log(item.id)
  84. uni.showActionSheet({
  85. itemList: ['编辑', '删除'],
  86. success: (res) => {
  87. if (res.tapIndex === 0) {
  88. let info = JSON.stringify(item)
  89. uni.navigateTo({
  90. url: `/pagesRepairs/edit/edit?info=${info}`
  91. })
  92. } else if (res.tapIndex === 1) {
  93. uni.showModal({
  94. title: '提示',
  95. content: `确定删除${item.userName}吗?`,
  96. success: async (res) => {
  97. if (res.confirm) {
  98. const res = await this.$myRequest_repairs({
  99. url: '/repairUser/deleteRepairUserSettingById',
  100. data: {
  101. id: item.id
  102. }
  103. })
  104. // console.log(res)
  105. if (res.code === '200') {
  106. uni.showToast({
  107. title: '删除成功',
  108. icon: 'success'
  109. })
  110. setTimeout(() => {
  111. this.getData()
  112. }, 1500)
  113. }
  114. }
  115. }
  116. })
  117. }
  118. },
  119. fail: (res) => {}
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .container {
  127. width: 100vw;
  128. height: calc(100vh - 152rpx);
  129. font-size: 32rpx;
  130. overflow-y: auto;
  131. .search {
  132. display: flex;
  133. align-items: center;
  134. margin: 30rpx auto 30rpx;
  135. width: 690rpx;
  136. height: 80rpx;
  137. border-radius: 4rpx;
  138. background-color: #f2f2f2;
  139. img {
  140. margin: 0 20rpx;
  141. width: 40rpx;
  142. height: 40rpx;
  143. }
  144. input {
  145. flex: 1;
  146. padding: 10rpx;
  147. }
  148. }
  149. .title {
  150. display: flex;
  151. align-items: flex-end;
  152. box-sizing: border-box;
  153. padding: 0 30rpx;
  154. height: 80rpx;
  155. font-size: 36rpx;
  156. font-weight: bold;
  157. border-top: 1rpx solid #e5e5e5;
  158. }
  159. .box {
  160. display: flex;
  161. align-items: center;
  162. padding-right: 30rpx;
  163. height: 160rpx;
  164. border-bottom: 1rpx solid #e5e5e5;
  165. img {
  166. margin: 0 24rpx 0 27rpx;
  167. width: 82rpx;
  168. height: 82rpx;
  169. border-radius: 50%;
  170. }
  171. .item_info {
  172. display: flex;
  173. flex-direction: column;
  174. .info_msg {
  175. display: flex;
  176. align-items: center;
  177. font-size: 32rpx;
  178. font-weight: bold;
  179. .msg_work {
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. margin-left: 13rpx;
  184. padding: 0 10rpx;
  185. height: 32rpx;
  186. color: #6fb6b8;
  187. font-size: 24rpx;
  188. font-weight: 400;
  189. border-radius: 7rpx;
  190. border: 1rpx solid #6fb6b8;
  191. }
  192. }
  193. .info_phone {
  194. margin-top: 10rpx;
  195. color: #808080;
  196. // font-size: 28rpx;
  197. }
  198. }
  199. .item_type {
  200. margin-left: auto;
  201. // font-size: 24rpx;
  202. }
  203. .color_type2 {
  204. color: #1e7dfb;
  205. }
  206. .color_type3 {
  207. color: #ff5733;
  208. }
  209. }
  210. .no_data {
  211. text-align: center;
  212. color: #b3b3b3;
  213. font-size: 24rpx;
  214. img {
  215. margin: 215rpx auto 0;
  216. width: 480rpx;
  217. height: 508rpx;
  218. }
  219. }
  220. }
  221. </style>