addressBook.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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="list2.length">外部维修成员({{ list2.length }})</view>
  9. <!-- 每一个外部维修成员区域 -->
  10. <view class="box" v-for="item in list2" :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="list.length">内部维修成员({{ list.length }})</view>
  23. <!-- 每一个内部维修成员区域 -->
  24. <view class="box" v-for="item in list" :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. const userInfo = uni.getStorageSync('repairsUserInfo')
  61. this.userId = userInfo.userId
  62. this.schoolId = userInfo.schoolId
  63. this.getData()
  64. },
  65. methods: {
  66. async getData() {
  67. const res = await this.$myRequest_repairs({
  68. url: '/repairUser/getAddressBook',
  69. data: {
  70. schoolId: this.schoolId,
  71. userId: this.userId,
  72. keyWord: this.keyWord
  73. }
  74. })
  75. // console.log(res)
  76. if (res.code === '200') {
  77. this.list = res.data[0].list
  78. this.list2 = res.data[1].list
  79. }
  80. },
  81. handleEdit(item) {
  82. // console.log(item.id)
  83. uni.showActionSheet({
  84. itemList: ['编辑', '删除'],
  85. success: (res) => {
  86. if (res.tapIndex === 0) {
  87. let info = JSON.stringify(item)
  88. uni.navigateTo({
  89. url: `/pagesRepairs/edit/edit?info=${info}`
  90. })
  91. } else if (res.tapIndex === 1) {
  92. uni.showModal({
  93. title: '提示',
  94. content: `确定删除${item.userName}吗?`,
  95. success: async (res) => {
  96. if (res.confirm) {
  97. const res = await this.$myRequest_repairs({
  98. url: '/repairUser/deleteRepairUserSettingById',
  99. data: {
  100. id: item.id
  101. }
  102. })
  103. // console.log(res)
  104. if (res.code === '200') {
  105. uni.showToast({
  106. title: '删除成功',
  107. icon: 'success'
  108. })
  109. setTimeout(() => {
  110. this.getData()
  111. }, 1500)
  112. }
  113. }
  114. }
  115. })
  116. }
  117. },
  118. fail: (res) => {}
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .container {
  126. width: 100vw;
  127. height: calc(100vh - 152rpx);
  128. font-size: 32rpx;
  129. overflow-y: auto;
  130. .search {
  131. display: flex;
  132. align-items: center;
  133. margin: 30rpx auto 30rpx;
  134. width: 690rpx;
  135. height: 80rpx;
  136. border-radius: 4rpx;
  137. background-color: #f2f2f2;
  138. img {
  139. margin: 0 20rpx;
  140. width: 40rpx;
  141. height: 40rpx;
  142. }
  143. input {
  144. flex: 1;
  145. padding: 10rpx;
  146. }
  147. }
  148. .title {
  149. display: flex;
  150. align-items: flex-end;
  151. box-sizing: border-box;
  152. padding: 0 30rpx;
  153. height: 80rpx;
  154. font-size: 36rpx;
  155. font-weight: bold;
  156. border-top: 1rpx solid #e5e5e5;
  157. }
  158. .box {
  159. display: flex;
  160. align-items: center;
  161. padding-right: 30rpx;
  162. height: 160rpx;
  163. border-bottom: 1rpx solid #e5e5e5;
  164. img {
  165. margin: 0 24rpx 0 27rpx;
  166. width: 82rpx;
  167. height: 82rpx;
  168. border-radius: 50%;
  169. }
  170. .item_info {
  171. display: flex;
  172. flex-direction: column;
  173. .info_msg {
  174. display: flex;
  175. align-items: center;
  176. font-size: 32rpx;
  177. font-weight: bold;
  178. .msg_work {
  179. display: flex;
  180. justify-content: center;
  181. align-items: center;
  182. margin-left: 13rpx;
  183. padding: 0 10rpx;
  184. height: 32rpx;
  185. color: #6fb6b8;
  186. font-size: 24rpx;
  187. font-weight: 400;
  188. border-radius: 7rpx;
  189. border: 1rpx solid #6fb6b8;
  190. }
  191. }
  192. .info_phone {
  193. margin-top: 10rpx;
  194. color: #808080;
  195. // font-size: 28rpx;
  196. }
  197. }
  198. .item_type {
  199. margin-left: auto;
  200. // font-size: 24rpx;
  201. }
  202. .color_type2 {
  203. color: #1e7dfb;
  204. }
  205. .color_type3 {
  206. color: #ff5733;
  207. }
  208. }
  209. .no_data {
  210. text-align: center;
  211. color: #b3b3b3;
  212. font-size: 24rpx;
  213. img {
  214. margin: 215rpx auto 0;
  215. width: 480rpx;
  216. height: 508rpx;
  217. }
  218. }
  219. }
  220. </style>