selectionWorkers.vue 5.1 KB

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