helpPeople.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="container">
  3. <!-- 输入框区域 -->
  4. <view class="search">
  5. <img src="../../static/images/repairsImg/search.png" @click="handleSearch" />
  6. <input type="text" placeholder="请输入搜索内容" v-model="searchValue" />
  7. </view>
  8. <!-- 协作人区域 -->
  9. <view class="body">
  10. <!-- 每一个协作人区域 -->
  11. <view class="body_item" v-for="item in list" :key="item.id" @click="change(item)">
  12. <radio color="#6FB6B8" :checked="item.checked" />
  13. <img src="../../static/images/repairsImg/photo.png" />
  14. <view class="item_info">
  15. <view class="info_msg">
  16. {{ item.userName || item.name }}
  17. <view class="msg_work">{{ item.workType }}</view>
  18. </view>
  19. <view class="info_phone">{{ item.userPhone }}</view>
  20. </view>
  21. <view class="item_type color_type2" v-if="item.state === '正常接单'">正常接单</view>
  22. <view class="item_type color_type3" v-if="item.state === '停止接单'">停止接单</view>
  23. </view>
  24. </view>
  25. <view class="btn" v-if="checkList.length" @click="handleDispatch">确认派单</view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. // 搜索框绑定数据
  33. searchValue: '',
  34. // 列表
  35. list: [],
  36. // 选中列表
  37. checkList: [],
  38. // 页面类型
  39. // 空 为协作人列表 1 2 为派单人列表 3 为转线下员工列表
  40. type: null,
  41. // 订单id
  42. recordId: '',
  43. info: {}
  44. }
  45. },
  46. onLoad(options) {
  47. // console.log(options)
  48. this.recordId = options.id
  49. if (options.type) {
  50. this.type = options.type
  51. uni.setNavigationBarTitle({
  52. title: '派单'
  53. })
  54. if (this.type === '3') {
  55. this.getDataOffline()
  56. } else {
  57. this.getData()
  58. }
  59. } else {
  60. this.getHelpData()
  61. }
  62. if (options.info) {
  63. this.info = JSON.parse(options.info)
  64. }
  65. },
  66. methods: {
  67. // 获取转线下员工列表数组
  68. async getDataOffline() {
  69. const res = await this.$myRequest_repairs({
  70. url: '/repairUser/queryPageOfflineUsers',
  71. data: {
  72. currentPage: 1,
  73. pageCount: 999,
  74. recordId: this.recordId,
  75. keyWord: this.searchValue
  76. }
  77. })
  78. // console.log(res)
  79. if (res.code === '200') {
  80. this.list = res.data.list
  81. this.list.forEach((ele) => {
  82. ele.checked = false
  83. })
  84. }
  85. },
  86. // 获取协作人列表数组
  87. async getHelpData() {
  88. const res = await this.$myRequest_repairs({
  89. url: '/repairUser/queryPageCollaborator',
  90. data: {
  91. currentPage: 1,
  92. pageCount: 999,
  93. schoolId: uni.getStorageSync('repairsUserInfo').schoolId,
  94. userId: uni.getStorageSync('repairsUserInfo').userId,
  95. keyWord: this.searchValue
  96. }
  97. })
  98. // console.log(res)
  99. if (res.code === '200') {
  100. this.list = res.data.list
  101. this.list.forEach((ele) => {
  102. ele.checked = false
  103. })
  104. }
  105. },
  106. // 获取派单人列表数组
  107. async getData() {
  108. const res = await this.$myRequest_repairs({
  109. url: '/repairUser/queryPageOfflineUsers',
  110. data: {
  111. currentPage: 1,
  112. pageCount: 999,
  113. recordId: this.recordId,
  114. keyWord: this.searchValue
  115. }
  116. })
  117. // console.log(res)
  118. if (res.code === '200') {
  119. this.list = res.data.list
  120. this.list.forEach((ele) => {
  121. ele.checked = false
  122. })
  123. }
  124. },
  125. // 确认派单按钮回调
  126. handleDispatch() {
  127. if (this.type) {
  128. if (this.checkList.length > 1) {
  129. uni.showToast({
  130. title: '只能派单给一位师傅',
  131. icon: 'none'
  132. })
  133. return
  134. }
  135. uni.showModal({
  136. title: '提示',
  137. content: `确定把单派给${this.checkList[0].userName}吗?`,
  138. success: async (res) => {
  139. if (res.confirm) {
  140. // 直接派单
  141. if (this.type === '1') {
  142. const res = await this.$myRequest_repairs({
  143. url: '/repairRecord/receiveSendOrders',
  144. method: 'post',
  145. data: {
  146. id: this.checkList[0].id,
  147. acceptanceTime: this.checkList[0].acceptanceTime,
  148. shiftId: this.checkList[0].shiftId,
  149. articleId: this.checkList[0].articleId,
  150. recordId: this.recordId
  151. }
  152. })
  153. // console.log(res)
  154. if (res.code === '200') {
  155. uni.showToast({
  156. title: '派单成功',
  157. icon: 'success'
  158. })
  159. setTimeout(() => {
  160. uni.reLaunch({
  161. url: '/pagesRepairs/box/box'
  162. })
  163. }, 1500)
  164. }
  165. } else if (this.type === '2' || this.type === '3') {
  166. // 转单审核同意时重新派单
  167. // 2为线上 3为线下
  168. const res = await this.$myRequest_repairs({
  169. url: this.type === '2' ? '/repairRecord/transfer' : '/repairRecord/offline',
  170. method: 'post',
  171. data: {
  172. id: this.info.id,
  173. userId: this.checkList[0].id,
  174. approverStatu: 1,
  175. remark: this.info.remark
  176. }
  177. })
  178. // console.log(res)
  179. if (res.code === '200') {
  180. uni.showToast({
  181. title: '派单成功',
  182. icon: 'success'
  183. })
  184. setTimeout(() => {
  185. uni.reLaunch({
  186. url: '/pagesRepairs/box/box'
  187. })
  188. }, 1500)
  189. }
  190. }
  191. }
  192. }
  193. })
  194. } else {
  195. uni.$emit('addCheckList', {
  196. data: this.checkList
  197. })
  198. uni.navigateBack(1)
  199. }
  200. },
  201. // 点击每一个协作人的回调
  202. change(item) {
  203. item.checked = !item.checked
  204. let temList = []
  205. temList = this.list.filter((item) => {
  206. return item.checked
  207. })
  208. this.checkList = temList
  209. },
  210. handleSearch() {
  211. this.list = []
  212. if (this.type) {
  213. if (this.type === '3') {
  214. this.getDataOffline()
  215. } else {
  216. this.getData()
  217. }
  218. } else {
  219. this.getHelpData()
  220. }
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .container {
  227. font-size: 32rpx;
  228. .search {
  229. display: flex;
  230. align-items: center;
  231. margin: 30rpx auto 30rpx;
  232. width: 690rpx;
  233. height: 80rpx;
  234. border-radius: 4rpx;
  235. background-color: #f2f2f2;
  236. img {
  237. margin: 0 20rpx;
  238. width: 40rpx;
  239. height: 40rpx;
  240. }
  241. input {
  242. flex: 1;
  243. padding: 10rpx;
  244. }
  245. }
  246. .body {
  247. height: 810rpx;
  248. border-top: 1rpx solid #e5e5e5;
  249. overflow-y: auto;
  250. .body_item {
  251. display: flex;
  252. align-items: center;
  253. padding: 0 30rpx;
  254. height: 162rpx;
  255. border-bottom: 1rpx solid #e5e5e5;
  256. img {
  257. margin: 0 24rpx 0 27rpx;
  258. width: 82rpx;
  259. height: 82rpx;
  260. border-radius: 50%;
  261. }
  262. .item_info {
  263. display: flex;
  264. flex-direction: column;
  265. .info_msg {
  266. display: flex;
  267. align-items: center;
  268. font-size: 32rpx;
  269. font-weight: bold;
  270. .msg_work {
  271. display: flex;
  272. justify-content: center;
  273. align-items: center;
  274. margin-left: 13rpx;
  275. padding: 0 10rpx;
  276. height: 32rpx;
  277. color: #6fb6b8;
  278. font-size: 24rpx;
  279. font-weight: 400;
  280. border-radius: 7rpx;
  281. border: 1rpx solid #6fb6b8;
  282. }
  283. }
  284. .info_phone {
  285. margin-top: 10rpx;
  286. color: #808080;
  287. // font-size: 28rpx;
  288. }
  289. }
  290. .item_type {
  291. margin-left: auto;
  292. // font-size: 24rpx;
  293. }
  294. .color_type2 {
  295. color: #1e7dfb;
  296. }
  297. .color_type3 {
  298. color: #ff5733;
  299. }
  300. }
  301. }
  302. .btn {
  303. position: absolute;
  304. bottom: 66rpx;
  305. display: flex;
  306. justify-content: center;
  307. align-items: center;
  308. margin: 0 30rpx;
  309. width: 690rpx;
  310. height: 100rpx;
  311. color: #fff;
  312. font-size: 32rpx;
  313. border-radius: 12rpx;
  314. background-color: #6fb6b8;
  315. }
  316. }
  317. </style>