selectionWorkers.vue 4.8 KB

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