selectionWorkers.vue 4.5 KB

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