createGroup.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. this.getBrandList()
  78. }
  79. })
  80. },
  81. confirmWebsitDialog(e) {
  82. this.websit = this.websitList[e[0]]
  83. this.isShowWebsitDialog = false
  84. this.worker = null
  85. this.workerList = []
  86. this.getBrandList()
  87. },
  88. getBrandList() {
  89. this.$api.post('/worker/team/query/websit/worker', { websitId: this.websit?.websitId }).then(res => {
  90. this.workerList = res.data
  91. })
  92. },
  93. confirmBrandDialog(e) {
  94. this.worker = this.workerList[e[0]]
  95. this.isShowBrandDialog = false
  96. },
  97. tijiaozubie() {
  98. if (!this.websit) {
  99. this.$toast('请选择所属网点')
  100. return
  101. }
  102. if (!this.worker) {
  103. this.$toast('请选择组队师傅')
  104. return
  105. }
  106. this.$api
  107. .postJson('/worker/team/add', {
  108. assistantWorkerId: this.worker.workerId,
  109. assistantWorkerName: this.worker.workerName,
  110. websitId: this.websit?.websitId
  111. })
  112. .then(res => {
  113. uni.$emit('shuaxianliebiao')
  114. this.$navToPage(
  115. {
  116. delta: 1
  117. },
  118. 'navigateBack'
  119. )
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .form-container {
  127. background: #ffffff;
  128. margin-top: 20rpx;
  129. border-top: 1px solid #f5f5f5;
  130. .item {
  131. height: 108rpx;
  132. border-bottom: 1px solid #f5f5f5;
  133. display: flex;
  134. align-items: center;
  135. justify-content: space-between;
  136. padding: 0 20rpx;
  137. .label {
  138. margin-right: 30rpx;
  139. min-width: 200rpx;
  140. text {
  141. color: $error-color;
  142. }
  143. }
  144. .picker {
  145. .placeholder {
  146. color: $sec-font;
  147. }
  148. .iconfont {
  149. margin-left: 12rpx;
  150. color: $sec-font;
  151. }
  152. }
  153. ::v-deep .u-radio-group {
  154. flex: unset;
  155. .u-radio {
  156. margin-left: 50rpx;
  157. }
  158. }
  159. }
  160. }
  161. </style>