helpPeople.vue 5.7 KB

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