selectionWorkers.vue 5.2 KB

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