selectionWorkers.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="z-popup">
  3. <view class="zhuangtaitubiao" style="justify-content: flex-start !important">
  4. <view class="title">
  5. <tag
  6. style="
  7. background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
  8. border-radius: 4rpx;
  9. box-sizing: border-box;
  10. padding: 10rpx;
  11. opacity: 0;
  12. "
  13. >
  14. <text style="color: #ffffff">{{ detail.orderSmallTypeText.slice(0, 2) }}</text>
  15. </tag>
  16. <view>
  17. {{ title }}
  18. </view>
  19. <tag
  20. style="
  21. background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
  22. border-radius: 4rpx;
  23. box-sizing: border-box;
  24. padding: 10rpx;
  25. "
  26. >
  27. <text style="color: #ffffff">{{ detail.orderSmallTypeText.slice(0, 2) }}</text>
  28. </tag>
  29. </view>
  30. <!-- <view class="row">
  31. <view class="label">工单类型:</view>
  32. <view class="value">
  33. <tag
  34. style="
  35. background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
  36. border-radius: 4rpx;
  37. box-sizing: border-box;
  38. padding: 10rpx;
  39. "
  40. >
  41. <text style="color: #ffffff">{{ detail.orderSmallTypeText.slice(0, 2) }}</text>
  42. </tag>
  43. </view>
  44. </view> -->
  45. <view class="row">
  46. <view class="label">客户名称:</view>
  47. <view class="value">{{ detail.userName }}</view>
  48. </view>
  49. <view class="row">
  50. <view class="label">客户电话:</view>
  51. <view class="value">{{ detail.userMobile }}</view>
  52. </view>
  53. <view class="row">
  54. <view class="label">客户地址:</view>
  55. <view class="value">{{ detail.address || detail.gpsAddress }}</view>
  56. </view>
  57. <view class="row" v-if="isShow && !!workerList.length">
  58. <view class="label">选择小工:</view>
  59. <view class="value price">
  60. <checkbox-group @change="changeXz" style="width: 100%">
  61. <label
  62. v-for="(item, index) in workerList"
  63. :key="index"
  64. style="width: 50%; display: inline-block; margin-bottom: 20rpx"
  65. >
  66. <checkbox :value="item.workerId" :checked="item.isSelect" />{{ item.workerName }}
  67. </label>
  68. </checkbox-group>
  69. </view>
  70. </view>
  71. <view class="row" v-if="isShow && !workerList.length">
  72. <view style="color: red" v-if="detail.needSlave">您当前没有组队小工,此单必须要选小工</view>
  73. <view style="color: red" v-else>您当前没有组队小工</view>
  74. </view>
  75. <view class="kakakakak">
  76. <u-button text="取消" @click="quxiao"></u-button>
  77. <view style="min-width: 30rpx"></view>
  78. <u-button
  79. v-if="detail.needSlave ? !!workerList.length : true"
  80. type="primary"
  81. text="确认"
  82. @click="querenss"
  83. ></u-button>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. props: {
  91. title: {
  92. type: [String],
  93. default: '接收确认'
  94. },
  95. detail: {
  96. type: Object,
  97. default: () => ({})
  98. },
  99. type: {
  100. type: [String, Number],
  101. default: 0
  102. },
  103. callback: {
  104. type: Function,
  105. default: () => {}
  106. }
  107. },
  108. data() {
  109. return {
  110. isShow: false,
  111. workerList: [],
  112. checkboxValues: []
  113. }
  114. },
  115. mounted() {
  116. this.getBrandList()
  117. },
  118. methods: {
  119. getBrandList() {
  120. if (this?.detail?.id) {
  121. this.$api
  122. .post('/pg/order/base/slave/worker/team', {
  123. orderBaseId: this?.detail?.id
  124. })
  125. .then(res => {
  126. this.isShow = true
  127. this.workerList = res.data
  128. })
  129. }
  130. },
  131. changeXz(v) {
  132. this.checkboxValues = v.target.value
  133. },
  134. querenss() {
  135. if (this.type == 1) {
  136. // 接单
  137. this.$api
  138. .post('/pg/order/base/rece', {
  139. orderBaseId: this.detail.id,
  140. workerList: (this.checkboxValues || []).join(',')
  141. })
  142. .then(res => {
  143. this.callback?.()
  144. })
  145. } else if (this.type == 2) {
  146. // 抢单
  147. this.$api
  148. .post('/pg/order/base/qd', {
  149. orderBaseId: this.detail.id,
  150. workerList: (this.checkboxValues || []).join(',')
  151. })
  152. .then(res => {
  153. this.callback?.()
  154. })
  155. } else if (this.type == 3) {
  156. // 更换
  157. this.$api
  158. .post('/pg/order/base/change/slave/worker/team', {
  159. orderBaseId: this.detail.id,
  160. workerList: (this.checkboxValues || []).join(',')
  161. })
  162. .then(res => {
  163. this.callback?.()
  164. })
  165. }
  166. },
  167. quxiao() {
  168. this.$emit('close')
  169. }
  170. }
  171. }
  172. </script>
  173. <style scoped lang="scss">
  174. .z-popup {
  175. position: fixed;
  176. background: rgba(0, 0, 0, 0.2);
  177. width: 100%;
  178. height: 100vh;
  179. z-index: 1000000000;
  180. left: 0;
  181. right: 0;
  182. top: 0;
  183. bottom: 0;
  184. transition: top 0.5s;
  185. box-sizing: border-box;
  186. padding: 60rpx;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. .zhuangtaitubiao {
  191. width: 100%;
  192. height: auto;
  193. box-sizing: border-box;
  194. padding: 30rpx;
  195. background: #fff;
  196. border-radius: 20rpx;
  197. margin-bottom: 50rpx;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. flex-direction: column;
  202. }
  203. .title {
  204. font-size: 28rpx;
  205. font-weight: bold;
  206. align-items: left;
  207. width: 100%;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. }
  212. .row {
  213. display: flex;
  214. align-items: left;
  215. margin-top: 30rpx;
  216. width: 100%;
  217. .label {
  218. color: $sec-font;
  219. min-width: 160rpx;
  220. }
  221. .price {
  222. width: 100%;
  223. }
  224. }
  225. .kakakakak {
  226. width: 100%;
  227. height: auto;
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. margin-top: 40rpx;
  232. }
  233. }
  234. </style>