createGroup.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="form-container">
  4. <view class="item" @tap="isShowWebsitDialog = true">
  5. <view class="label"><text>*</text>所属网点</view>
  6. <view class="picker">
  7. <text class="value" v-if="websit">{{ websit.name }}</text>
  8. <text class="placeholder" v-else>请选择所属网点</text>
  9. <text class="iconfont icon-jinru"></text>
  10. </view>
  11. </view>
  12. <view class="item" @tap="isShowBrandDialog = true">
  13. <view class="label"><text>*</text>选择组队师傅</view>
  14. <view class="picker">
  15. <text class="value" v-if="worker">{{ worker.workerName }}</text>
  16. <text class="placeholder" v-else>请选择</text>
  17. <text class="iconfont icon-jinru"></text>
  18. </view>
  19. </view>
  20. </view>
  21. <template slot="footer">
  22. <view class="footer-btn-group">
  23. <u-button type="primary" text="提交" @click="tijiaozubie"></u-button>
  24. </view>
  25. </template>
  26. <zjDialogPicker
  27. ref="websitDialog"
  28. :isShow="isShowWebsitDialog"
  29. :multiple="false"
  30. :styleType="2"
  31. :title="'所属网点'"
  32. :list="websitList"
  33. :keyName="'name'"
  34. @cancel="isShowWebsitDialog = false"
  35. @confirm="confirmWebsitDialog"
  36. >
  37. </zjDialogPicker>
  38. <zjDialogPicker
  39. ref="workerDialog"
  40. :isShow="isShowBrandDialog"
  41. :multiple="false"
  42. :styleType="2"
  43. :title="'组队师傅'"
  44. :list="workerList"
  45. :keyName="'workerName'"
  46. @cancel="isShowBrandDialog = false"
  47. @confirm="confirmBrandDialog"
  48. >
  49. </zjDialogPicker>
  50. </zj-page-layout>
  51. </template>
  52. <script>
  53. import zjDialogPicker from '@/components/zj-dialog/zj-dialog-picker.vue'
  54. export default {
  55. components: {
  56. zjDialogPicker
  57. },
  58. data() {
  59. return {
  60. websit: null,
  61. websitList: [],
  62. isShowWebsitDialog: false,
  63. worker: null,
  64. workerList: [],
  65. isShowBrandDialog: false
  66. }
  67. },
  68. onLoad() {
  69. this.getWebsitList()
  70. },
  71. methods: {
  72. getWebsitList() {
  73. this.$api.get('/user/apply/websit').then(res => {
  74. this.websitList = res.data
  75. if (this.websitList.length == 1) {
  76. this.websit = this.websitList[0]
  77. }
  78. })
  79. },
  80. confirmWebsitDialog(e) {
  81. this.websit = this.websitList[e[0]]
  82. this.isShowWebsitDialog = false
  83. this.worker = null
  84. this.workerList = []
  85. this.getBrandList()
  86. },
  87. getBrandList() {
  88. this.$api.post('/worker/team/query/websit/worker', { websitId: this.websit?.websitId }).then(res => {
  89. this.workerList = res.data
  90. })
  91. },
  92. confirmBrandDialog(e) {
  93. this.worker = this.workerList[e[0]]
  94. this.isShowBrandDialog = false
  95. },
  96. tijiaozubie() {
  97. if (!this.websit) {
  98. this.$toast('请选择所属网点')
  99. return
  100. }
  101. if (!this.worker) {
  102. this.$toast('请选择组队师傅')
  103. return
  104. }
  105. this.$api
  106. .post('/worker/team/add', {
  107. assistantWorkerId: this.worker.workerId,
  108. assistantWorkerName: this.worker.workerName,
  109. websitId: this.websit?.websitId
  110. })
  111. .then(res => {
  112. this.$navToPage(
  113. {
  114. delta: 1
  115. },
  116. 'navigateBack'
  117. )
  118. })
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .form-container {
  125. background: #ffffff;
  126. margin-top: 20rpx;
  127. border-top: 1px solid #f5f5f5;
  128. .item {
  129. height: 108rpx;
  130. border-bottom: 1px solid #f5f5f5;
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. padding: 0 20rpx;
  135. .label {
  136. margin-right: 30rpx;
  137. min-width: 200rpx;
  138. text {
  139. color: $error-color;
  140. }
  141. }
  142. .picker {
  143. .placeholder {
  144. color: $sec-font;
  145. }
  146. .iconfont {
  147. margin-left: 12rpx;
  148. color: $sec-font;
  149. }
  150. }
  151. ::v-deep .u-radio-group {
  152. flex: unset;
  153. .u-radio {
  154. margin-left: 50rpx;
  155. }
  156. }
  157. }
  158. }
  159. </style>