helpPeople.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="container">
  3. <!-- 输入框区域 -->
  4. <view class="search">
  5. <img src="../../static/images/repairsImg/search.png" />
  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. type: null,
  40. // 订单id
  41. recordId: '',
  42. info: {}
  43. }
  44. },
  45. onLoad(options) {
  46. // console.log(options)
  47. this.recordId = options.id
  48. if (options.type) {
  49. this.type = options.type
  50. uni.setNavigationBarTitle({
  51. title: '派单'
  52. })
  53. this.getData()
  54. } else {
  55. this.getHelpData()
  56. }
  57. if (options.info) {
  58. this.info = JSON.parse(options.info)
  59. }
  60. },
  61. methods: {
  62. // 获取协作人列表数组
  63. async getHelpData() {
  64. const res = await this.$myRequest_repairs({
  65. url: '/repairUser/queryPageCollaborator',
  66. data: {
  67. currentPage: 1,
  68. pageCount: 999,
  69. schoolId: uni.getStorageSync('repairsUserInfo').schoolId,
  70. userId: uni.getStorageSync('repairsUserInfo').userId,
  71. keyWord: this.searchValue
  72. }
  73. })
  74. // console.log(res)
  75. if (res.code === '200') {
  76. this.list = res.data.list
  77. this.list.forEach((ele) => {
  78. ele.checked = false
  79. })
  80. }
  81. },
  82. // 获取派单人列表数组
  83. async getData() {
  84. const res = await this.$myRequest_repairs({
  85. url: '/repairUser/queryPageRepairUsers',
  86. data: {
  87. currentPage: 1,
  88. pageCount: 999,
  89. recordId: this.recordId,
  90. keyWord: this.searchValue
  91. }
  92. })
  93. // console.log(res)
  94. if (res.code === '200') {
  95. this.list = res.data.list
  96. this.list.forEach((ele) => {
  97. ele.checked = false
  98. })
  99. }
  100. },
  101. // 确认派单按钮回调
  102. handleDispatch() {
  103. if (this.type) {
  104. if (this.checkList.length > 1) {
  105. uni.showToast({
  106. title: '只能派单给一位师傅',
  107. icon: 'none'
  108. })
  109. return
  110. }
  111. uni.showModal({
  112. title: '提示',
  113. content: `确定把单派给${this.checkList[0].userName}吗?`,
  114. success: async (res) => {
  115. if (res.confirm) {
  116. // 直接派单
  117. if (this.type === '1') {
  118. const res = await this.$myRequest_repairs({
  119. url: '/repairRecord/receiveSendOrders',
  120. method: 'post',
  121. data: {
  122. id: this.checkList[0].id,
  123. acceptanceTime: this.checkList[0].acceptanceTime,
  124. shiftId: this.checkList[0].shiftId,
  125. articleId: this.checkList[0].articleId,
  126. recordId: this.recordId
  127. }
  128. })
  129. // console.log(res)
  130. if (res.code === '200') {
  131. uni.showToast({
  132. title: '派单成功',
  133. icon: 'success'
  134. })
  135. setTimeout(() => {
  136. uni.reLaunch({
  137. url: '/pagesRepairs/box/box'
  138. })
  139. }, 1500)
  140. }
  141. } else if (this.type === '2') {
  142. // 转单审核同意时重新派单
  143. const res = await this.$myRequest_repairs({
  144. url: '/repairRecord/transfer',
  145. method: 'post',
  146. data: {
  147. id: this.info.id,
  148. userId: this.checkList[0].id,
  149. approverStatu: 1,
  150. remark: this.info.remark
  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. }
  166. }
  167. }
  168. })
  169. } else {
  170. uni.$emit('addCheckList', {
  171. data: this.checkList
  172. })
  173. uni.navigateBack(1)
  174. }
  175. },
  176. // 点击每一个协作人的回调
  177. change(item) {
  178. item.checked = !item.checked
  179. let temList = []
  180. temList = this.list.filter((item) => {
  181. return item.checked
  182. })
  183. this.checkList = temList
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .container {
  190. font-size: 32rpx;
  191. .search {
  192. display: flex;
  193. align-items: center;
  194. margin: 30rpx auto 30rpx;
  195. width: 690rpx;
  196. height: 80rpx;
  197. border-radius: 4rpx;
  198. background-color: #f2f2f2;
  199. img {
  200. margin: 0 20rpx;
  201. width: 40rpx;
  202. height: 40rpx;
  203. }
  204. input {
  205. flex: 1;
  206. padding: 10rpx;
  207. }
  208. }
  209. .body {
  210. height: 810rpx;
  211. border-top: 1rpx solid #e5e5e5;
  212. overflow-y: auto;
  213. .body_item {
  214. display: flex;
  215. align-items: center;
  216. padding: 0 30rpx;
  217. height: 162rpx;
  218. border-bottom: 1rpx solid #e5e5e5;
  219. img {
  220. margin: 0 24rpx 0 27rpx;
  221. width: 82rpx;
  222. height: 82rpx;
  223. border-radius: 50%;
  224. }
  225. .item_info {
  226. display: flex;
  227. flex-direction: column;
  228. .info_msg {
  229. display: flex;
  230. align-items: center;
  231. font-size: 32rpx;
  232. font-weight: bold;
  233. .msg_work {
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. margin-left: 13rpx;
  238. padding: 0 10rpx;
  239. height: 32rpx;
  240. color: #6fb6b8;
  241. font-size: 24rpx;
  242. font-weight: 400;
  243. border-radius: 7rpx;
  244. border: 1rpx solid #6fb6b8;
  245. }
  246. }
  247. .info_phone {
  248. margin-top: 10rpx;
  249. color: #808080;
  250. // font-size: 28rpx;
  251. }
  252. }
  253. .item_type {
  254. margin-left: auto;
  255. // font-size: 24rpx;
  256. }
  257. .color_type2 {
  258. color: #1e7dfb;
  259. }
  260. .color_type3 {
  261. color: #ff5733;
  262. }
  263. }
  264. }
  265. .btn {
  266. position: absolute;
  267. bottom: 66rpx;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. margin: 0 30rpx;
  272. width: 690rpx;
  273. height: 100rpx;
  274. color: #fff;
  275. font-size: 32rpx;
  276. border-radius: 12rpx;
  277. background-color: #6fb6b8;
  278. }
  279. }
  280. </style>